Extract channel join logic into seperate method

This commit is contained in:
HerHde 2020-03-22 02:57:12 +01:00
parent 22e705a469
commit d0d1f538a4
2 changed files with 9 additions and 7 deletions

View File

@ -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):

View File

@ -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
# =======================