diff --git a/command.py b/command.py index 54b9e29..4fa43c3 100644 --- a/command.py +++ b/command.py @@ -611,8 +611,7 @@ def cmd_stop_and_getout(bot, user, text, command, parameter): if var.playlist.mode == "one-shot": var.playlist.clear() - if bot.channel: - bot.mumble.channels.find_by_name(bot.channel).move_in() + bot.join_channel() def cmd_volume(bot, user, text, command, parameter): diff --git a/mumbleBot.py b/mumbleBot.py index 72771c9..417072b 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -131,11 +131,7 @@ class MumbleBot: self.mumble.is_ready() # wait for the connection self.set_comment() self.mumble.users.myself.unmute() # by sure the user is not muted - if self.channel: - if '/' in self.channel: - self.mumble.channels.find_by_tree(channel.split('/')).move_in() - else: - self.mumble.channels.find_by_name(self.channel).move_in() + self.join_channel() self.mumble.set_bandwidth(200000) self.is_ducking = False @@ -197,6 +193,13 @@ class MumbleBot: def set_comment(self): self.mumble.users.myself.comment(var.config.get('bot', 'comment')) + def join_channel(self): + if self.channel: + if '/' in self.channel: + self.mumble.channels.find_by_tree(self.channel.split('/')).move_in() + else: + self.mumble.channels.find_by_name(self.channel).move_in() + # ======================= # Message # =======================