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
- bot.registration.ACCEPT_REGISTRATION_HANDLER = <telegram.ext.callbackqueryhandler.CallbackQueryHandler object>¶
Handler used to parse the acceptance of a registration request.
- 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 andcontext.match.group(2)
the index of the accepted member date orNone
.- Type
- bot.registration.DENY_REGISTRATION = 'deny_registration {}'¶
Callback data for denying a registration request. Use as
DENY_REGISTRATION.format(chat_id)
.- Type
- bot.registration.DENY_REGISTRATION_HANDLER = <telegram.ext.callbackqueryhandler.CallbackQueryHandler object>¶
Handler used to parse the denial of a registration request.
- 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
- 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 thetelegram.ext.Dispatcher
.
- Return type
- bot.registration.check_registration_status(update, context)¶
Checks the registration of the user. This can have four outcomes:
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.The user has sent a registration request, which is pending. In this case, updates will be answered with a note asking to be patient.
The user has successfully bee registered. Nothing happens in this case.
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 thetelegram.ext.Dispatcher
.
- Raises
telegram.ext.DispatcherHandlerStop – In case the update is not to be handled by any other handlers.
- Return type
- 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 thetelegram.ext.Dispatcher
.
- Return type
- 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 thetelegram.ext.Dispatcher
.
- Return type
- 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 thetelegram.ext.Dispatcher
.
- Return type