Moderate command empty reply fix
This commit is contained in:
parent
44810372cd
commit
7e32e0bd00
|
@ -4,7 +4,7 @@ from src.config import config, trigram_repository
|
|||
|
||||
class Moderate(Base):
|
||||
aliases = ['mod_f', 'mod_d']
|
||||
super_admins = [int(id) for id in config.getlist('bot', 'god_mode')]
|
||||
gods = [int(id) for id in config.getlist('bot', 'god_mode')]
|
||||
|
||||
@staticmethod
|
||||
def execute(bot, command):
|
||||
|
@ -17,8 +17,11 @@ class Moderate(Base):
|
|||
|
||||
if command.name == 'mod_f':
|
||||
words = trigram_repository.find_word(command.chat_id, command.args[0].strip())
|
||||
reply = '\n'.join(words)
|
||||
if reply == '':
|
||||
reply = 'Nothing found'
|
||||
|
||||
Moderate.reply(bot, command, '\n'.join(words))
|
||||
Moderate.reply(bot, command, reply)
|
||||
elif command.name == 'mod_d':
|
||||
trigram_repository.remove_word(command.chat_id, command.args[0].strip())
|
||||
except (IndexError, ValueError):
|
||||
|
@ -31,4 +34,4 @@ class Moderate(Base):
|
|||
user_id = entity.message.from_user.id
|
||||
admin_ids = list(map(lambda m: m.user.id, bot.get_chat_administrators(entity.chat_id)))
|
||||
|
||||
return user_id in admin_ids or user_id in Moderate.super_admins
|
||||
return user_id in admin_ids or user_id in Moderate.gods
|
||||
|
|
Loading…
Reference in New Issue