Skip to content

Commit d6d40ac

Browse files
committed
fix: ban/warn delegate deleteMsg to ctx.{ban|warn}
1 parent 614043d commit d6d40ac

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

handlers/commands/ban.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ const banHandler = async (ctx) => {
5252
return ctx.replyWithHTML('ℹ️ <b>Can\'t ban other admins.</b>');
5353
}
5454

55-
if (ctx.message.reply_to_message) {
56-
ctx.deleteMessage(ctx.message.reply_to_message.message_id)
57-
.catch(() => null);
58-
}
59-
6055
if (!flags.has('amend') && userToBan.status === 'banned') {
6156
return ctx.replyWithHTML(
6257
html`🚫 ${displayUser(userToBan)} <b>is already banned.</b>`,
@@ -67,6 +62,7 @@ const banHandler = async (ctx) => {
6762
admin: ctx.from,
6863
reason: '[' + ctx.chat.title + '] ' + await substom(reason),
6964
userToBan,
65+
msg: ctx.message.reply_to_message
7066
});
7167
};
7268

handlers/commands/report.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const reportHandler = async ctx => {
2727
if (!ctx.message.reply_to_message) {
2828
await ctx.deleteMessage();
2929
return ctx.replyWithHTML(
30-
'ℹ️ <b>Reply to message you\'d like to report</b>',
30+
'ℹ️ <b>Reply to the message you\'d like to report</b>',
3131
).then(scheduleDeletion());
3232
}
3333
const admins = (await ctx.getChatAdministrators())

handlers/commands/warn.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,13 @@ const warnHandler = async (ctx) => {
4545
.then(scheduleDeletion());
4646
}
4747

48-
if (ctx.message.reply_to_message) {
49-
ctx.deleteMessage(ctx.message.reply_to_message.message_id)
50-
.catch(() => null);
51-
}
52-
5348
return ctx.warn({
5449
admin: ctx.from,
5550
amend: flags.has('amend'),
5651
reason: '[' + ctx.chat.title + '] ' + await substom(reason),
5752
userToWarn,
5853
mode: 'manual',
54+
msg: ctx.message.reply_to_message,
5955
});
6056
};
6157

0 commit comments

Comments
 (0)