mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-09-01 22:55:24 +00:00
Add "report handled" button
This commit is contained in:
@@ -22,15 +22,6 @@ const reportHandler = async ctx => {
|
|||||||
replyOptions
|
replyOptions
|
||||||
).then(scheduleDeletion());
|
).then(scheduleDeletion());
|
||||||
}
|
}
|
||||||
if (chats.report) {
|
|
||||||
ctx.tg.sendMessage(
|
|
||||||
chats.report,
|
|
||||||
`❗️ Report in <a href="${msgLink(msg.reply_to_message)}">` +
|
|
||||||
escapeHtml(msg.chat.title) +
|
|
||||||
'</a>!',
|
|
||||||
replyOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const admins = (await ctx.getChatAdministrators())
|
const admins = (await ctx.getChatAdministrators())
|
||||||
.filter(member =>
|
.filter(member =>
|
||||||
member.status === 'creator' ||
|
member.status === 'creator' ||
|
||||||
@@ -45,9 +36,24 @@ const reportHandler = async ctx => {
|
|||||||
const adminsMention = adminObjects.map(link).join('');
|
const adminsMention = adminObjects.map(link).join('');
|
||||||
const s = `❗️${link(ctx.from)} <b>reported the message to the admins.</b>` +
|
const s = `❗️${link(ctx.from)} <b>reported the message to the admins.</b>` +
|
||||||
`${adminsMention}`;
|
`${adminsMention}`;
|
||||||
return ctx.replyWithHTML(s, {
|
const report = await ctx.replyWithHTML(s, {
|
||||||
reply_to_message_id: msg.reply_to_message.message_id
|
reply_to_message_id: msg.reply_to_message.message_id
|
||||||
});
|
});
|
||||||
|
if (chats.report) {
|
||||||
|
await ctx.tg.sendMessage(
|
||||||
|
chats.report,
|
||||||
|
`❗️ Report in <a href="${msgLink(msg.reply_to_message)}">` +
|
||||||
|
escapeHtml(msg.chat.title) +
|
||||||
|
'</a>!',
|
||||||
|
{ ...replyOptions,
|
||||||
|
reply_markup: { inline_keyboard: [ [ {
|
||||||
|
text: '✔️ Handled',
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
callback_data: `/del -chat_id=${report.chat.id} -msg_id=${report.message_id} Report handled`
|
||||||
|
} ] ] } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = reportHandler;
|
module.exports = reportHandler;
|
||||||
|
Reference in New Issue
Block a user