2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-24 02:47:48 +00:00

26 lines
719 B
JavaScript
Raw Permalink Normal View History

2017-09-24 18:05:16 +02:00
'use strict';
// Utils
2020-05-13 21:35:17 +02:00
const { html, TgHtml } = require('../../utils/html');
const { quietLink, scheduleDeletion } = require('../../utils/tg');
2017-09-24 18:05:16 +02:00
// DB
2017-09-27 00:11:20 +03:30
const { getAdmins } = require('../../stores/user');
2017-09-24 18:05:16 +02:00
2020-03-10 22:10:48 +01:00
/** @param { import('../../typings/context').ExtendedContext } ctx */
2017-09-24 18:05:16 +02:00
const staffHandler = async ctx => {
2017-09-27 00:11:20 +03:30
const admins = await getAdmins();
2017-11-23 22:29:40 +03:30
admins.sort((a, b) => a.first_name > b.first_name ? 1 : -1);
2017-09-24 18:05:16 +02:00
const links = admins.map(quietLink);
2017-09-24 18:05:16 +02:00
2020-05-13 21:35:17 +02:00
const list = TgHtml.join('\n', links.map(s => html`${s}`));
2017-09-24 18:05:16 +02:00
2020-05-13 21:35:17 +02:00
return ctx.replyWithHTML(html`<b>Admins in the network:</b>\n\n${list}`, {
2017-09-24 18:05:16 +02:00
disable_notification: true,
disable_web_page_preview: true,
}).then(scheduleDeletion());
2017-09-24 18:05:16 +02:00
};
module.exports = staffHandler;