Callback modules

Description

Modules that handle the callbacks the bot recognizes and reacts to

callback_handlers

Handles the callbacks

modules.callbacks.callback_handlers.alter_setting_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext)

Handles the alter setting callback Modify the setting based on the button pressed or finalize it

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

modules.callbacks.callback_handlers.image_crop_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the image crop callback Modifies the cropping parameters The conversation remains in the “crop” state or is put 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.callbacks.callback_handlers.image_random_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the image random callback Makes yhe user try the generation again The conversation remains in the “random” state or is put 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.callbacks.callback_handlers.image_resize_mode_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the image resize mode crop callback Sets the resize mode of the image (‘crop’, ‘scale’, ‘random’) Puts the conversation in the “background” state

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int

modules.callbacks.callback_handlers.settings_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext)

Handles the settings callback Select which setting the user wants to modify

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

modules.callbacks.callback_handlers.template_callback(update: telegram.update.Update, context: telegram.ext.callbackcontext.CallbackContext) → int

Handles the template callback Select the desidered template Puts the conversation in the “title” state

Parameters
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Returns

new state of the conversation

Return type

int