fix channel helper commands

This commit is contained in:
bakatrouble 2022-04-02 12:42:36 +03:00
parent 626cc2b990
commit 9c2928fa4e

View File

@ -122,7 +122,8 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
i.send(bot)
def handle_delete(self, update: Update, ctx: CallbackContext):
if update.effective_message.chat_id != self.chat_id:
if self.users.count() and not self.users.filter(user_id=update.effective_user.id).count():
update.effective_message.reply_text('GTFO')
return
reply_to_id = update.effective_message.reply_to_message.message_id
try:
@ -132,7 +133,8 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
update.effective_message.reply_text('Deleted')
def handle_count(self, update: Update, ctx: CallbackContext):
if update.effective_message.chat_id != self.chat_id:
if self.users.count() and not self.users.filter(user_id=update.effective_user.id).count():
update.effective_message.reply_text('GTFO')
return
update.effective_message.reply_text(f'{QueuedItem.objects.filter(config=self).count()} items queued')