bot Module#

Methods for the bot functionality.

bot.ADMIN: int = -1

Chat ID of the admin. Needs to be overridden in main.py

Type:

int

bot.CALLBACK_NO: str = 'dont_postpone'

Callback data for not postponing reminders.

Type:

str

bot.HOMEPAGE: str = 'https://Bibo-Joshi.github.io/memoriae-bot/'

Homepage of this bot.

Type:

str

async bot.answer_postponed_reminder(update, context)

Deletes the auxiliary reminder and posts the original one. Also asks whether to postpone it again.

Parameters:
Return type:

None

async bot.answer_reminder(update, _)

Answers a reminder and asks whether to postpone it.

Parameters:
  • update (Update) – The Telegram update.

  • _ – The callback context as provided by the application.

Return type:

None

async bot.delete_message(update, _)

Deletes the message of the incoming callback query.

Parameters:
  • update (Update) – The Telegram update.

  • _ – The callback context as provided by the application.

Return type:

None

async bot.error(update, context)

Informs the originator of the update that an error occurred and forwards the traceback to the admin.

Parameters:
Return type:

None

async bot.info(update, _)

Returns some info about the bot.

Parameters:
  • update (Update) – The Telegram update.

  • _ – The callback context as provided by the application.

Return type:

None

bot.keyboard(update=None, message_id=None)

Builds the keyboard to append to postpone messages. Exactly one of the optionals mey be passed.

Parameters:
  • update (Optional[Update]) – Optional. A Telegram update. If passed, the contained message will be the postponed reminder.

  • message_id (Optional[str]) – Optional. A messages ID. If passed, the corresponding measseg will be the postponed reminder.

Return type:

InlineKeyboardMarkup

async bot.register_application(application)

Adds handlers and sets up jobs. Convenience method to avoid doing that all in the main script.

Parameters:

application (Application) – The telegram.ext.Dispatcher.

Return type:

None