Module package

Subpackages

Description

Modules

callback_handlers

Common query callback families

module.callback_handlers.exit_handler(update, context)

Called when the user wants to close a sub-menu. Removes the message from the user’s chat

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Return type:

None

module.callback_handlers.informative_callback(update, context)

Called by any command that needs to show information to the user

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Return type:

None

module.callback_handlers.localization_handler(update, context)

Called by any query that needs to show a localized text to the user

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Return type:

None

module.callback_handlers.md_handler(update, context)

Called by any query that needs to show the contents of a markdown file to the user

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Return type:

None

module.callback_handlers.none_handler(update, _)

Called when the user clicks an unactive button. Stops the spinning circle

Parameters:
  • update (Update) – update event

  • context – context passed by the handler

Return type:

None

module.callback_handlers.submenu_handler(update, context)

Called by sm_.* callbacks. Opens the requested sub-menu, usually by editing the message and adding an InlineKeyboard

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

Return type:

None

easter_egg_func

Nobody knows what those functions do

module.easter_egg_func.bladrim(update, context)
module.easter_egg_func.lei_che_ne_pensa_signorina(update, context)
module.easter_egg_func.prof_sticker(update, context)
module.easter_egg_func.prof_sticker_id()
Return type:

str

module.easter_egg_func.santino(update, context)
module.easter_egg_func.smonta_portoni(update, context)
module.easter_egg_func.uni_bandita(update, context)

job_updater

Job updater

module.job_updater.check_exam_reminders(context)

Job function to check for exams 14 days and 4 days from now and send reminder.

Return type:

None

module.job_updater.updater_lep(_)

Called with a set frequence. Updates all the scrapables

Parameters:

context – context passed by the handler

shared

Constants and common functions

module.shared.check_log(update, command_name, is_query=False)

If enabled, logs the command

Parameters:
  • update (Update) – update event

  • command_name (str) – name of the event to log

  • is_query (bool) – whether the event to log is a query. Defaults to False.

module.shared.check_print_old_exams(year_exam)

Checks if the old exams should be considered

Parameters:

year_exam (str) – target year

Return type:

bool

Returns:

whether the old exams should be considered

module.shared.get_year_code(month, day)

Generates the code of the year

Parameters:
  • month (int) – month

  • day (int) – day

Return type:

str

Returns:

last two digits of the current year

module.shared.read_json(namefile)

Reads a json file

Parameters:

namefile (str) – name of the json file, without extension

Return type:

dict

Returns:

content of the json file, as a dictionary

module.shared.read_md(namefile)

Reads a markdown file

Parameters:

namefile (str) – name of the markdown file, without extension

Return type:

str

Returns:

content of the markdown file

module.shared.send_message(update, context, messaggio)

Replies with a message, making sure the maximum lenght text allowed is respected

Parameters:
  • update (Update) – update event

  • context (CallbackContext) – context passed by the handler

  • messaggio (str) – message to send