bot.registration Module

This module contains functions for registering users.

bot.registration.ACCEPT_REGISTRATION = 'accept_registration {} {}'

Callback data for accepting a registration request with a suggested members data. Use as ACCEPT_REGISTRATION_MEMBER.format(chat_id, data_index). Use '' for data_index, if no given data is to be accepted.

Type

str

bot.registration.ACCEPT_REGISTRATION_HANDLER = <telegram.ext.callbackqueryhandler.CallbackQueryHandler object>

Handler used to parse the acceptance of a registration request.

Type

telegram.ext.CallbackQueryHandler

bot.registration.ACCEPT_REGISTRATION_PATTERN = 'accept_registration (\\d*)(?: (\\d*))?'

Callback data pattern for accepting a registration request with a suggested members data. context.match.group(1) will be users id and context.match.group(2) the index of the accepted member date or None.

Type

str

bot.registration.DENY_REGISTRATION = 'deny_registration {}'

Callback data for denying a registration request. Use as DENY_REGISTRATION.format(chat_id).

Type

str

bot.registration.DENY_REGISTRATION_HANDLER = <telegram.ext.callbackqueryhandler.CallbackQueryHandler object>

Handler used to parse the denial of a registration request.

Type

telegram.ext.CallbackQueryHandler

bot.registration.DENY_REGISTRATION_PATTERN = 'deny_registration (\\d*)'

Callback data pattern for accepting a registration request with a suggested members data. context.match.group(1) will be users id.

Type

str

bot.registration.accept_registration_request(update, context)

Parses the admins response to a registration request and answers the user correspondingly.

Parameters
  • update (Update) – The update.

  • context (CallbackContext) – The context as provided by the telegram.ext.Dispatcher.

Return type

None

bot.registration.check_registration_status(update, context)

Checks the registration of the user. This can have four outcomes:

  1. The user is not yet registered. In this case only the /start command is accepted. Other updates will be answered with a note that the user needs to register.

  2. The user has sent a registration request, which is pending. In this case, updates will be answered with a note asking to be patient.

  3. The user has successfully bee registered. Nothing happens in this case.

  4. The user has been denied registration. In this case the update will not be processed any further.

If the update has no effective user, it won’t be handled in any case.

Parameters
  • update (Update) – The update.

  • context (CallbackContext) – The context as provided by the telegram.ext.Dispatcher.

Raises

telegram.ext.DispatcherHandlerStop – In case the update is not to be handled by any other handlers.

Return type

None

bot.registration.deny_registration_request(update, context)

Parses the admins response to a registration request and answers the user correspondingly.

Parameters
  • update (Update) – The update.

  • context (CallbackContext) – The context as provided by the telegram.ext.Dispatcher.

Return type

None

bot.registration.request_registration(update, context)

Triggers the registration process by sending the admin a message.

Parameters
  • update (Update) – The update.

  • context (CallbackContext) – The context as provided by the telegram.ext.Dispatcher.

Return type

None

bot.registration.start(update, context)

Greets the new user and asks them to register.

Parameters
  • update (Update) – The update.

  • context (CallbackContext) – The context as provided by the telegram.ext.Dispatcher.

Return type

None