Admin

misbot.admin.push_notification(bot, update)

Starts Push notification conversation. Asks for message and transfers control to notification_message()

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
Returns:

NOTIF_MESSAGE

Return type:

int

misbot.admin.notification_message(bot, update, user_data)

Ask for confirmation, stores the message in user_data dictionary, transfer control to notification_confirm()

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
  • user_data (dict) – User data dictionary
Returns:

NOTIF_CONFIRM

Return type:

int

misbot.admin.notification_confirm(bot, update, user_data)

Sends message if “Yes” is sent. Aborts if “No” is sent. Sends a message with statistics like users reached, time taken after sending push notification.

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
  • user_data (dict) – User data dictionary
Returns:

ConversationHandler.END

Return type:

int

misbot.admin.revert_notification(bot, update)

Delete a previously sent push notification. Ask for uuid of message to delete and pass control to ask_uuid()

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
misbot.admin.ask_uuid(bot, update, user_data)

Store the uuid, send confirmation message and pass control to confirm_revert()

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
  • user_data (dict) – Conversation data
misbot.admin.confirm_revert(bot, update, user_data)

If Yes, revert the specified message for all users and send a summary of the operation to admin.

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object
  • user_data (dict) – Conversation data
misbot.admin.clean_all_attendance_records(bot, update)

Activated by /clean command. See misbot.mis_utils.clean_attendance_records() to see what this does.

Parameters:
  • bot (telegram.bot.Bot) – Telegram Bot object
  • update (telegram.update.Update) – Telegram Update object