-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix most luacheck warnings and make the bot more modular #224
Fix most luacheck warnings and make the bot more modular #224
Conversation
Hold on, trow away variable |
Fixed. Should be ready to go now. |
What is the status of this? |
Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
- The only remaining global variable is bot, mostly to keep $stats working. Could avoid using a global by using a module instead - Move polling logic to polling.lua - Some strings may need to be readjusted Signed-off-by: Yan Minari <yangm97@gmail.com>
Signed-off-by: Yan Minari <yangm97@gmail.com>
Translation now uses i18n instead of _ Signed-off-by: Yan Minari <yangm97@gmail.com>
There’s only 7 warnings remaining now Signed-off-by: Yan Minari <yangm97@gmail.com>
This breaks the translation unfortunately. Gettext relies on scanning the file for _(...) to find translatable strings. You can change this prefix, but it has to be consistent for the collection to work. |
Which file need to be changed? |
Well, everything. The "localisation variable" needs to be the same everywhere. We could rename it to something like _T(...) or whatever, but it needs to be the same everywhere |
@NotAFile well, I’ve picked up i18n() as the localisation variable and used it everywhere (on the lua side of things) |
I’m not sure what’s needed to do on the gettext script though, in fact I even forgot it existed. |
From 1335 warnings to 11, I think that’s a pretty good start 😁
Overview:
dkjson
back tolua-cjson
lua/bot.lua
tolua/main.lua
lua/main.lua
topolling.lua
bot
(already added to .luacheckrc globals), mostly to keep the admin commands $init and $stats working. Could easily avoid that by using a module instead.Things to look after:
$init
doesn’t seem to be reloading the modules, possibly due to the fact none of them are global anymore. I think it may be better to replace it with something like$stop
and rely on the supervisor (docker, systemd,launch.sh
…) to relaunch