fix delete command, add count command to channel helper

master
bakatrouble 2 years ago
parent 867a3b84dc
commit 626cc2b990

@ -126,14 +126,20 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
return
reply_to_id = update.effective_message.reply_to_message.message_id
try:
msg = QueuedItem.objects.get(message_id=reply_to_id)
msg = QueuedItem.objects.get(message_id=reply_to_id, config=self)
msg.delete()
except QueuedItem.DoesNotExist:
update.effective_message.reply_text('Deleted')
def handle_count(self, update: Update, ctx: CallbackContext):
if update.effective_message.chat_id != self.chat_id:
return
update.effective_message.reply_text(f'{QueuedItem.objects.filter(config=self).count()} items queued')
def build_dispatcher(self, dispatcher: Dispatcher):
dispatcher.add_handler(MessageHandler(Filters.private, self.handle_message))
dispatcher.add_handler(CommandHandler(['delete', 'del', 'remove', 'rem'], self.handle_delete, Filters.reply))
dispatcher.add_handler(CommandHandler(['count'], self.handle_count))
dispatcher.add_handler(MessageHandler(Filters.private, self.handle_message))
return dispatcher

Loading…
Cancel
Save