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');
|
2017-10-31 22:20:49 +01:00
|
|
|
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
|
|
|
|
2017-10-22 17:33:21 +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,
|
2017-10-22 17:33:21 +02:00
|
|
|
disable_web_page_preview: true,
|
2018-11-20 11:47:30 +05:30
|
|
|
}).then(scheduleDeletion());
|
2017-09-24 18:05:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = staffHandler;
|