Merge pull request #107 from HerHde/master

Extract channel_join logic into seperate method
This commit is contained in:
azlux 2020-03-22 11:37:42 +01:00 committed by GitHub
commit 91f603c15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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": if var.playlist.mode == "one-shot":
var.playlist.clear() var.playlist.clear()
if bot.channel: bot.join_channel()
bot.mumble.channels.find_by_name(bot.channel).move_in()
def cmd_volume(bot, user, text, command, parameter): 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.mumble.is_ready() # wait for the connection
self.set_comment() self.set_comment()
self.mumble.users.myself.unmute() # by sure the user is not muted self.mumble.users.myself.unmute() # by sure the user is not muted
if self.channel: self.join_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.mumble.set_bandwidth(200000) self.mumble.set_bandwidth(200000)
self.is_ducking = False self.is_ducking = False
@ -197,6 +193,13 @@ class MumbleBot:
def set_comment(self): def set_comment(self):
self.mumble.users.myself.comment(var.config.get('bot', 'comment')) 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 # Message
# ======================= # =======================