Commands modules

Description

Modules that handle the commands the bot recognizes and reacts to

command_handlers

Handles the commands

modules.commands.command_handlers.background_msg(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the background message Saves the photo so it can be used as the background of the image

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int

modules.commands.command_handlers.cancel_cmd(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the /cancel command Cancels the current cretion of the image Puts the conversation in the “end” state

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int

modules.commands.command_handlers.caption_msg(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the caption message Saves the caption so it can be used as the caption of the image

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int

modules.commands.command_handlers.create_cmd(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the /settings command Start the process aimed to create the requested image Puts the conversation in the “template” state if all goes well, “end” state otherwise

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int

modules.commands.command_handlers.fail_msg(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → None

Handles the fail message The message sent during the creation of the image was not valid The state of the conversation stays the same

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

None

modules.commands.command_handlers.help_cmd(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext)

Handles the /help command Sends a short summary of the bot’s commands

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

modules.commands.command_handlers.settings_cmd(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext)

Handles the /settings command Let the user set some values used to create the image. Those settings apply to all users

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

modules.commands.command_handlers.start_cmd(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext)

Handles the /start command Sends a short welcoming message

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

modules.commands.command_handlers.title_msg(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the title message Saves the title so it can be used as the title of the image

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int