From 4ae9c1cdb77f20fb20ef157ad7baa27afcaa9848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20W=C3=BCrfl?= Date: Fri, 18 May 2018 17:46:21 +0200 Subject: [PATCH] wip --- configuration.ini | 4 ++-- interface.py | 2 +- mumbleBot.py | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/configuration.ini b/configuration.ini index 894a72f..fbb3549 100644 --- a/configuration.ini +++ b/configuration.ini @@ -1,8 +1,8 @@ [bot] comment = Coucou, Je suis née du savoir du Azlux, accès au https://azlux.fr/bot volume = 0.1 -admin = Azlux;AzMobile -music_folder = /home/dmichel/botamusique/music/ +admin = BafTac +music_folder = /home/fabian/music/mumblebot/ tmp_folder = /tmp/ is_proxified = True diff --git a/interface.py b/interface.py index 8307595..db8e303 100644 --- a/interface.py +++ b/interface.py @@ -113,4 +113,4 @@ def download(): if __name__ == '__main__': - web.run(port=8181, host="0.0.0.0") + web.run(port=8181, host="127.0.0.1") diff --git a/mumbleBot.py b/mumbleBot.py index 66f7637..13a35bf 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -109,11 +109,10 @@ class MumbleBot: print(command + ' - ' + parameter + ' by ' + self.mumble.users[text.actor]['name']) if command == self.config.get('command', 'play_file') and parameter: - path = self.config.get('bot', 'music_folder') + parameter - if "/" in parameter: - self.mumble.users[text.actor].send_message(self.config.get('strings', 'bad_file')) - elif os.path.isfile(path): - var.playlist.append(["file", path]) + music_folder = self.config.get('bot', 'music_folder') + path = os.path.abspath(os.path.join(music_folder, parameter)) + if path.startswith(music_folder) and os.path.isfile(path): + self.launch_play_file(path) else: self.mumble.users[text.actor].send_message(self.config.get('strings', 'bad_file')) @@ -275,7 +274,7 @@ class MumbleBot: def start_web_interface(): - interface.web.run(port=8181, host="0.0.0.0") + interface.web.run(port=8181, host="127.0.0.1") if __name__ == '__main__':