start using plugins
We want to avoid situations like: https://gitlab.torproject.org/tpo/anti-censorship/gettor-project/onionsproutsbot/-/blob/3edfb1c091c3b918629f0d06e767fc0137ddbf9e/OnionSproutsBot/bot.py#L372-L383
The patch was still merged, as it went kind-of-out-of-scope and I wanted to provide translators with the few, slightly altered strings as soon as possible.
Pyrogram has a built-in mechanism to specifically prevent this, which I avoided using as I believed that "plugins", in this case, insinuated that they could be dynamically removed or added, which was very suboptimal, considering that the functions we wanted to "abstract" into separate files were linked to specific buttons under bot.py
and we could not check whether a plugin was imported or not. Apparently, according to @StarByte, this doesn't matter as "plugins" can't be loaded or unloaded during runtime, and my confusion stemmed from my experience with other libraries that interface with instant messaging apps.
For this task to be complete, it'd be optimal to:
- separate some helper functions currently under
dialogue.py
- shove all callback-needing functions in
dialogue.py
in a new file and remove the aforementioned "ugly hack" from bot.py - move most of the functions in
bot.py
to a plugin file
(Note: https://gitlab.torproject.org/tpo/anti-censorship/gettor-project/onionsproutsbot/-/issues/42 has to be dealt with first)