bot.ban Module

This module contains functions for banning users.

bot.ban.BANNING_PATTERN = '.*ID:(\\d*)'

Pattern to extract the ID to be banned in the CONFIRMATION state. context.matches.group(1) will be the id (as string).

Type

str

bot.ban.CONFIRMATION = 'CONFIRMATION'

State of the conversation in which the cancellation is to be confirmed.

Type

str

bot.ban.CONFIRMATION_TEXT = 'Hinfort! Garstiges Gesindel!'

The text used to confirm the ban.

Type

str

bot.ban.CONVERSATION_INTERRUPT_TEXT = 'Hey. Du bist gerade dabei einen Nutzer zu sperren. Bring das erstmal zu Ende! '

Message to send, if the user tries to interrupt this conversation.

Type

str

bot.ban.CONVERSATION_VALUE = 'banning'

The value of context.user_data[CONVERSATION_KEY] if the user is in a banning conversation.

Type

str

bot.ban.SELECTING_USER = 'SELECTING_USER'

State of the conversation in which the user to ban is selected.

Type

str

bot.ban.ask_for_confirmation(update, context)

Asks the admin for confirmation.

Parameters
  • update (Update) – The update.

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

Return type

str

bot.ban.build_banning_handler(admin)

Returns a handler used to ban members, which is accessible only for the admin.

Parameters

admin (int) – The admins ID

Return type

ConversationHandler

bot.ban.cancel_banning(update, context)

Cancels the banning.

Parameters
  • update (Update) – The update.

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

Return type

int

bot.ban.confirm(update, context)

Deletes the member, bans it permanently and informs both the admin and the member.

Parameters
  • update (Update) – The update.

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

Return type

int

bot.ban.select_user(update, context)

Asks the admin which user is to be banned.

Parameters
  • update (Update) – The update.

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

Return type

str