bot.editing Module

This module contains functions for editing user information.

bot.editing.ADDRESS = 'address'

Identifier of the state in which the address is changed.

Type

str

bot.editing.ADDRESS_CONFIRMATION = 'ADDRESS_CONFIRMATION'

Identifier of the state in which the address change is confirmed.

Type

str

bot.editing.ADDRESS_CONFIRMATION_KEYBOARD = <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object>

Keyboard for confirming the address.

Type

telegram.InlineKeyboardMarkup

bot.editing.ALLOW_CONTACT_SHARING = 'allow_contact_sharing'

Identifier of the state in which the privacy setting is changed.

Type

str

bot.editing.BACK_OR_DELETE_KEYBOARD = <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object>

Keyboard for either leaving the setting as is or deleting its current value.

Type

telegram.InlineKeyboardMarkup

bot.editing.CHOOSING_MEMBER = 'choosing_member'

Identifier of the state in which the admin chooses a member to edit.

Type

str

bot.editing.CONVERSATION_INTERRUPT_TEXT = 'Upsi! Du bearbeitest gerade noch Deine Daten. Bitte schließe das ab. Danach kannst Du mit mir machen, was Du willst. 😏 '

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

Type

str

bot.editing.CONVERSATION_VALUE = 'editing'

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

Type

str

bot.editing.CORRECT = 'Richtig'

Callback data for “correct”.

Type

obj

Type

str

bot.editing.DATE_OF_BIRTH = 'date_of_birth'

Identifier of the state in which the date of birth is changed.

Type

str

bot.editing.DELETE = 'DELETE'

Callback data for deleting a setting.

Type

obj

Type

str

bot.editing.FIRST_NAME = 'first_name'

Identifier of the state in which the first name is changed.

Type

str

bot.editing.FUNCTIONS = 'functions'

Identifier of the state in functions are changed.

Type

str

bot.editing.GENDER = 'gender'

Identifier of the state in which the gender is changed.

Type

str

bot.editing.GENDER_KEYBOARD = <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object>

Keyboard for selecting a gender.

Type

telegram.InlineKeyboardMarkup

bot.editing.INSTRUMENTS = 'instruments'

Identifier of the state in which the instruments are changed.

Type

str

bot.editing.JOINED = 'joined'

Identifier of the state in which the year of joining AkaBlas is changed.

Type

str

bot.editing.LAST_NAME = 'last_name'

Identifier of the state in which the last name is changed.

Type

str

bot.editing.MENU = 'MENU'

Identifier of the menu state.

Type

str

bot.editing.NICKNAME = 'nickname'

Identifier of the state in which the nickname is changed.

Type

str

bot.editing.NO = 'Nein'

Callback data for “no”.

Type

obj

Type

str

bot.editing.PHONE_NUMBER = 'phone_number'

Identifier of the state in which the phone number is changed.

Type

str

bot.editing.PHONE_NUMBER_KEYBOARD = <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object>

Keyboard for selecting a gender.

Type

telegram.InlineKeyboardMarkup

bot.editing.PHOTO = 'PHOTO'

Identifier of the state in which the photo is changed.

Type

str

bot.editing.TEXTS: Dict[str, str] = {'ADDRESS_CONFIRMATION': 'Okay, ich habe die folgende Adresse erkannt:\n\n{}\n\nWenn das richtig war, klicke bitte auf <i>Richtig</i>. Wenn das nicht richtig war, versuch bitte, die Adresse genauer aufzuschreiben oder den Standort genauer zu wählen. Du kannst mir auch direkt die richtigen Koordinaten schicken. Mehr Infos dazu stehen in den <a href="https://akablas.github.io/AkaNamen-Bot/faq.html#der-bot-nimmt-meine-adresse-nicht-an-ist-der-blod">FAQ</a>. 🤓', 'MENU': 'Dann lass uns mal schauen, ob Deine Daten noch aktuell sind. Bitte achte darauf, dass Du nur korrekte Angaben machst. Deine Daten lauten aktuell:\n\n{}\n\nUm eine Angabe zu ändern, klicke unten auf den entsprechenden Knopf.', 'PHOTO': {False: 'Aktuell habe ich kein Foto von Dir. Um ein Foto zu hinterlegen, schicke mir das Foto. Bitte achte darauf, dass man Dich darauf gut erkennen kann. Um das Foto so zu lassen oder zu löschen, nutze die Knöpfe unten. Du kannst auch Dein aktuellen Telegram-Profilbild übernehmen.', True: 'Dies ist das Foto, das ich aktuell gespeichert habe. Um Dein Foto zu ändern, schicke mir das neue Foto. Bitte achte darauf, dass man Dich darauf gut erkennen kann. Um das Foto so zu lassen oder zu löschen, nutze die Knöpfe unten. Du kannst auch Dein aktuellen Telegram-Profilbild übernehmen.'}, 'address': 'Die Adresse, die ich gespeichert habe lautet:\n\nAdresse: {}\n\nUm die Adresse zu ändern, schicke mir entweder die Adresse als Text oder schicke mir einen Standort. Um die Adresse so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'allow_contact_sharing': 'Du kannst entscheiden, ob andere AkaBlasen, die auch den AkaNamen-Bot nutzen, Deine Daten über diesen abrufen dürfen. Deine aktuelle Einstellung ist: {}. Bitte nutze die Knöpfe unten für die Antwort.', 'date_of_birth': 'Das Geburtsdatum, das ich gespeichert habe ist:\n\nGeburtsdatum: {}\n\nUm das Datum zu ändern, schicke mir das neue Datum im Format <i>DD.MM.JJJJ</i>. Um das Datum so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'first_name': 'Aktuell habe ich gespeichert:\n\nVorname: {}\n\nUm den Namen zu ändern, schicke mir den neuen Namen. Um den Namen so zu lassen oder zu löschen, nutze die Knöpfe unten. ', 'functions': 'Die Ämter, die ich gespeichert habe lauten:\n\nÄmter: {}\n\nUm die Ämter zu ändern, schicke sie mir als Komma-getrennte Liste. Um die Ämter so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'gender': 'Das Geschlecht, das ich gespeichert habe ist:\n\nGeschlecht: {}\n\nUm Dein Geschlecht zu ändern, es so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'instruments': 'Die Instrumente, die Du aktuell spielst, sind unten markiert. Um die Auswahl zu ändern, klicke auf die Instrumente.\n\nDu kannst auch mehrere Instrumente auswählen. Bitte mach das nur, wenn Du sie auch alle regelmäßig bei AkaBlas spielst. 😉\n\nWenn Du fertig bist, klicke unten auf <i>Weiter</i>.', 'joined': 'Das Beitrittsjahr, das ich gespeichert habe ist:\n\n{}\n\nUm das Beitrittsjahr zu ändern, schicke mir das neue Jahr im Format <i>JJJJ</i>. Um das Jahr so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'last_name': 'Der Nachname, den ich gespeichert habe lautet:\n\nNachname: {}\n\nUm den Namen zu ändern, schicke mir den neuen Namen. Um den Namen so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'nickname': 'Der Spitzname, den ich gespeichert habe lautet:\n\nSpitzname: {}\n\nUm den Namen zu ändern, schicke mir den neuen Namen. Um den Namen so zu lassen oder zu löschen, nutze die Knöpfe unten.', 'phone_number': 'Die Handynummer, die ich gespeichert habe lautet:\n\nHandynummer: {}\n\nUm die Nummer zu ändern, so zu lassen oder zu löschen, nutze die Knöpfe unten.'}

Texts for the different states.

Type

Dict[str,:obj:str]

bot.editing.TG_PROFILE_PICTURE = 'TG_PROFILE_PICTURE'

Callback data indicating that the profile picture of a user should be used as picture.

Type

obj

Type

str

bot.editing.YES = 'Ja'

Callback data for “yes”.

Type

obj

Type

str

bot.editing.YES_NO_KEYBOARD = <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object>

Keyboard for a yes or no choice.

Type

telegram.InlineKeyboardMarkup

bot.editing.address(update, context)

Parses the reply and asks the user for confirmation of the extracted address.

Parameters
  • update (Update) – The update.

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

Returns

If an address/location was given PHOTO: Else.

Return type

MENU

bot.editing.admin_menu(update, context)

Starts the conversation for the admin and displays the menu.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

MENU

bot.editing.allow_contact_sharing(update, context)

Parses the reply for the privacy settings.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

MENU

bot.editing.build_editing_handler(admin)

Returns a handler used to edit members, with a special menu only available for the admin.

Parameters

admin (int) – The admins ID

Return type

ConversationHandler

bot.editing.choose_member(update, context)

Provides the admin with a list of members to choose from.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

CHOOSING_MEMBER

bot.editing.date_of_birth(update, context)

Parses the reply for the date of birth

Parameters
  • update (Update) – The update.

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

Returns

If input was not parsable ADDRESS: Else.

Return type

MENU

bot.editing.delete_keyboard(context)

Tries to delete the inline keyboard from the last message. If a telegram.error.BadRequest exception occurs this is most likely due to the message having no keyboard and hence it will be ignored.

Parameters

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

Return type

None

bot.editing.functions(update, context)

Parses the reply for the functions.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

MENU

bot.editing.get_member(update, context)

Returns the member to be edited. Takes into account the the admin may be editing one of the orchestras members

Parameters
  • update (Update) – The update.

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

Return type

Member

bot.editing.instruments(update, context)

Parses the reply and for the instruments.

Parameters
  • update (Update) – The update.

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

Returns

If the user is not yet done selecting ALLOW_CONTACT_SHARING: Else.

Return type

MENU

bot.editing.menu(update, context)

Starts the conversation and displays the menu.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

MENU

bot.editing.parse_selection(update, context)

Parses the selection from the menu and updates the message accordingly.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

The next state depending on the selection or telegram.ext.ConversationHandler.END

bot.editing.phone_number(update, context)

Parses the reply for the privacy settings.

Parameters
  • update (Update) – The update.

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

Returns

If the processing of the phone number is not yet finished. MENU: Else

Return type

PHONE_NUMBER

bot.editing.photo(update, context)

Parses the reply for the photo.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

MENU

bot.editing.reply_photo_state(update, member)

Deletes the message of a CallbackQuery and sends the text needed for requesting user input for the photo state. If currently a photo is set, it is send.

Parameters
  • update (Update) – The update.

  • member (Member) – The current member object.

Returns

The newly sent message.

Return type

Message

bot.editing.selection_keyboard(context)

Function building the selection keyboard.

Parameters

admin – Whether it’s the admin changing the user or not.

Returns: The keyboard.

Return type

InlineKeyboardMarkup

bot.editing.simple_callback_factory(attr)

Creates callbacks for the simple to handle attributes. The returned callback takes the arguments update, context as usual and returns MENU.

Parameters

attr (str) – The attribute to be parsed.

Return type

Callable[[Update, CallbackContext], str]

bot.editing.simple_handler_factory(attr, message_handler=True, filters=None)

Creates handlers for the simple to handle attributes. The returned list consists of

  • MessageHandler(Filters.text & ~Filters.command, simple_callback_factory(attr)), if requested

  • CallbackQueryHandler(simple_callback_factory(attr))

Parameters
Return type

List[Handler]

bot.editing.start_admin_editing(update, context)

Starts the editing conversation for the admin by redirecting to inline mode.

Parameters
  • update (Update) – The update.

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

Return type

str

Returns

CHOOSING_MEMBER