Browse Source

Add a status command

master
Steven Haussmann 5 years ago
parent
commit
ff6ebbfbc4
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      icon-poller.py

+ 12
- 0
icon-poller.py View File

@@ -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()

Loading…
Cancel
Save