2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-29 05:07:49 +00:00
2017-09-29 15:53:21 +02:00

32 lines
817 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
// Utils
const { link } = require('../../utils/tg');
// Bot
const { replyOptions } = require('../../bot/options');
// DB
const { getAdmins } = require('../../stores/user');
const reportHandler = async ctx => {
const msg = ctx.message;
if (!msg.reply_to_message) {
return ctx.reply(' <b>Reply to message you\'d like to report</b>',
replyOptions);
}
const admins = await getAdmins();
const adminObjects = admins.map(user => ({
first_name: '⭐️', // small hack to be able to use link function
id: user.id,
}));
const stars = adminObjects.map(link).join('');
const s = `📋 ${link(ctx.from)} <b>reported the message to admins:</b> ` +
`${stars}`;
return ctx.replyWithHTML(s, {
reply_to_message_id: msg.reply_to_message.message_id
});
};
module.exports = reportHandler;