diff --git a/icon-poller.py b/icon-poller.py index 198db1d..933597a 100644 --- a/icon-poller.py +++ b/icon-poller.py @@ -178,6 +178,16 @@ def cancel(update: Update, context: CallbackContext): submissions[chat_id] = {} del polls[chat_id] +@ensure_chat +def show_status(update: Update, context: CallbackContext): + chat_id = update.effective_chat.id + if status[chat_id] == "closed": + context.bot.send_message(chat_id=chat_id, text="I am currently closed.") + elif status[chat_id] == "open": + context.bot.send_message(chat_id=chat_id, text=f"I am currently open for submissions. There are {len(submissions[chat_id])} submissions.") + elif status[chat_id] == "polling": + context.bot.send_message(chat_id=chat_id, text="I am currently polling.") + if __name__ == "__main__": try: @@ -194,6 +204,8 @@ if __name__ == "__main__": dispatcher.add_handler(CommandHandler("poll", start_poll)) dispatcher.add_handler(CommandHandler("decide", decide_poll)) dispatcher.add_handler(CommandHandler("cancel", cancel)) + dispatcher.add_handler(CommandHandler("status", show_status)) + updater.start_polling() updater.idle() \ No newline at end of file