Closed marcopaganini closed 4 years ago
The problem doesn't exists in /language command, becuase it forces to uppercase the provided language (see this line).
So the problem just exists in Docker build due the new possibility to set a default initial language different than english... It can be fixed in two ways:
A. Modifying Docker Makefile adding a force uppercase (BOT_LANG=${BOT_LANG^^}) an check if a supported language was provided (needs to specify a list/array of supported languages int he makefile).
B. Adding a new function in bot source at initialization that set to default language value "EN" if the user has set an invalid one.
If we go A, the build process can stop and say to the user that he has provided an invalid argument and shows valids languages. However, this way means that we needs to add the supported languages list into the makefile and anytime a new language support is added, the Makefile needs to be modified to include it into the array.
If we go B, we can safe handle thet invalid provided language, but there is no way to tell the user that he has build the docker container with an invalid language.
So I decided to go A... Now there is a safe check in docker Makefile to verify that provided default Bot language is valid.
Issue solved, going to close it, feel free to re-open it again if there something that I have miss.
Setting
CONST.INIT_LANG
to an invalid value prevents the Bot from initializing properly, without any relevant error messages logged. The bot will run, but not respond to any commands.This is a particularly easy hole to fall in, since the
/language
command expects the language to be specified in lowercase (E.g, "en") but forCONFIG.INIT_LANG
, the language needs to be specified in upper case (E.g. "EN"). A simple case mismatch is enough to trigger the problem.