mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-09-05 08:35:22 +00:00
don't check for username if no user is found
This commit is contained in:
@@ -20,7 +20,7 @@ const banHandler = async ({ chat, message, reply, telegram, me, state }) => {
|
||||
: null;
|
||||
const reason = message.text.split(' ').slice(1).join(' ').trim();
|
||||
|
||||
if (!state.isAdmin || userToBan.username === me) return null;
|
||||
if (!state.isAdmin) return null;
|
||||
|
||||
if (message.chat.type === 'private') {
|
||||
return reply(
|
||||
@@ -36,6 +36,8 @@ const banHandler = async ({ chat, message, reply, telegram, me, state }) => {
|
||||
).then(scheduleDeletion);
|
||||
}
|
||||
|
||||
if (userToBan.username === me.toLowerCase()) return null;
|
||||
|
||||
if (await isAdmin(userToBan)) {
|
||||
return reply('ℹ️ <b>Can\'t ban other admins.</b>', replyOptions);
|
||||
}
|
||||
|
Reference in New Issue
Block a user