From 4597824fdb0cc9ef74bf8458db9b2bd3b855a2f5 Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Fri, 1 Jan 2021 14:41:17 +0800 Subject: [PATCH] feat: Added bot command `version` to display current version. Requested in #194. --- command.py | 5 +++++ configuration.default.ini | 1 + lang/en_US.json | 1 + 3 files changed, 7 insertions(+) diff --git a/command.py b/command.py index 769614c..ba255d4 100644 --- a/command.py +++ b/command.py @@ -73,6 +73,7 @@ def register_all_commands(bot): bot.register_command(commands('remove_webinterface_user'), cmd_web_user_remove, admin=True) bot.register_command(commands('list_webinterface_user'), cmd_web_user_list, admin=True) bot.register_command(commands('change_user_password'), cmd_user_password, no_partial_match=True) + bot.register_command(commands('version'), cmd_version, no_partial_match=True) # Just for debug use bot.register_command('rtrms', cmd_real_time_rms, True) # bot.register_command('loop', cmd_loop_state, True) @@ -1237,6 +1238,10 @@ def cmd_web_user_list(bot, user, text, command, parameter): bot.send_msg(tr('command_disabled', command=command), text) +def cmd_version(bot, user, text, command, parameter): + bot.send_msg(tr('report_version', version=bot.get_version()), text) + + # Just for debug use def cmd_real_time_rms(bot, user, text, command, parameter): bot._display_rms = not bot._display_rms diff --git a/configuration.default.ini b/configuration.default.ini index 7c3b303..4ead2bf 100644 --- a/configuration.default.ini +++ b/configuration.default.ini @@ -165,6 +165,7 @@ joinme = joinme queue = queue repeat = repeat random = random +version = version mode = mode update = update list_file = listfile diff --git a/lang/en_US.json b/lang/en_US.json index 91f2715..10770ff 100644 --- a/lang/en_US.json +++ b/lang/en_US.json @@ -57,6 +57,7 @@ "removed_tags_from_all": "Removed tags {tags} from songs on the playlist.", "removing_item": "Removed entry {item} from playlist.", "repeat": "Repeat {song} for {n} times.", + "report_version": "The current version of botamusique is {version}.", "shortlist_instruction": "Use !sl {indexes} to play the item you want.", "start_updating": "Start updating...", "stopped": "Music stopped.",