From 4f1372697b4b3ffa7381b2ad34ea499f912676a8 Mon Sep 17 00:00:00 2001 From: azlux Date: Tue, 5 Jun 2018 23:41:49 +0200 Subject: [PATCH] Better command,!help and custom file --- README.md | 8 +++++++ ...iguration.ini => configuration.default.ini | 22 +++++++++---------- mumbleBot.py | 3 ++- 3 files changed, 21 insertions(+), 12 deletions(-) rename configuration.ini => configuration.default.ini (75%) diff --git a/README.md b/README.md index 7aadfcc..1316df7 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,14 @@ chmod +x ./mumbleBot.py The bot listen to the 8181 port so you should redirect to this one in you NAT configuration to let others peoples access the web interface. (DISABLED) +#### Custom commands +You can copy the file `configuration.default.ini` to `configuration.ini` and customize all variable. +you have the section : +- bot : basic configuration of the bot : comment, folder, volume at start .... +- command : you can customize the command you want for each action (if you put `help = helpme` , the bot will response to `!helpme` ) +- readio : here you can have a list of default radio ( I can play a jazz radio with the command `!radio jazz`) +- strings : you can customize all string the bot can say. + 2.TODO list diff --git a/configuration.ini b/configuration.default.ini similarity index 75% rename from configuration.ini rename to configuration.default.ini index bfaefe2..927fa6f 100644 --- a/configuration.ini +++ b/configuration.default.ini @@ -1,8 +1,8 @@ [bot] -comment = Coucou, Je suis née du savoir du Azlux, accès au https://azlux.fr/bot +comment = Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun ! volume = 0.1 -admin = Azlux;AzMobile -music_folder = /home/dmichel/botamusique/music/ +admin = User1;User2; +music_folder = /home/azlux/botamusique/music_folder tmp_folder = /tmp/ ignored_folders = tmp ignored_files = Thumbs.db @@ -21,7 +21,7 @@ play_radio = radio help = help stop = stop list = list -next = next +next = skip current_music = np volume = v kill = kill @@ -38,10 +38,10 @@ jazz = http://jazz-wr04.ice.infomaniak.ch/jazz-wr04-128.mp3 [strings] current_volume = volume : %d%% -change_volume = volume : %d%% par %s -bad_command = Commande incorrecte -not_admin = T'es pas admin, patate ! -not_playing = Aucun stream en lecture +change_volume = volume : %d%% by %s +bad_command = Incorrect command +not_admin = You are not an admin ! +not_playing = No music right now bad_file = Bad file asked no_file = Not file here bad_url = Bad URL asked @@ -51,9 +51,9 @@ queue_empty = No more music in the playlist! now_playing = Now playing %s
%s help = Command available: -
!play_file -
!play_url - youtube or soundcloud -
!play_radio - url of a stream +
!file +
!url - youtube or soundcloud +
!radio - url of a stream
!list - display list of available tracks
!queue - display items in queue
!next - jump to the next music of the playlist diff --git a/mumbleBot.py b/mumbleBot.py index 26cca79..a752cc5 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -374,7 +374,8 @@ if __name__ == '__main__': args = parser.parse_args() config = configparser.ConfigParser(interpolation=None) - parsed_configs = config.read(args.config, encoding='latin-1') + parsed_configs = config.read(['configuration.default.ini', args.config], encoding='latin-1') + if len(parsed_configs) == 0: print('Could not read configuration from file \"{}\"'.format(args.config), file=sys.stderr) sys.exit()