2
0
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:
Pouria Ezzati
2017-11-23 18:06:52 +03:30
parent a88984d6a1
commit e9695208eb
2 changed files with 6 additions and 2 deletions

View File

@@ -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);
}