Skip to content

Skip to welcome_message if lang is known

GeopJr requested to merge GeopJr/onionsproutsbot:skip-lang-if-known into main

There are two approaches to this:

  • Creating custom callbacks
  • Splitting welcome_command and start_command into functions that don't require the whole callback

While I initially started with the first option, I decided to go with the second one for the following reason:

Crafting custom callbacks can be done in two ways (afaik): CallbackQuery & strings + extra parameters.

  • Using CallbackQuery depends on Telegram & Pyrogram and any api change would probably require additional maintenance
  • Using strings + extra parameters requires additional runtime checks that can be avoided by using the second option

The general design I followed is the following:

Flowchart showing the design of the language changing menu - svg

Before merging

We already detect the locale that the user speaks and use it to ask them in their own language what language they would like to use.

However I set it as English as I'm a bit confused. If a user wants to change their language, could that be because they actually don't know or are not proficient enough in it? If so, I'm not sure if showing them yet another message in that unknown language would be ideal.

  • 'Change Language' should stay in English / not be translated, right?

MR is a draft until these get resolved!

Example

Detected German, skipped to welcome command > Change Language > English > welcome command

Screenshot of telegram chat between me and onionsproutsbot, shows me having sent '/start', then the welcome_command in German, then the start_command in English and then the welcome_command in English

fixes: #16 (closed)

(f-pushed for commit message change)

Edited by n0toose

Merge request reports

Loading