mirror of
https://github.com/azlux/botamusique
synced 2024-11-23 22:06:09 +00:00
Compare commits
No commits in common. "02abdd63894189097de0032e0bd094861ccf773f" and "9b9b4e40ce7b077ebfa3b9be08d32025d1e43bc3" have entirely different histories.
02abdd6389
...
9b9b4e40ce
@ -9,7 +9,7 @@ volumes:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-web
|
- name: build-web
|
||||||
image: node:16
|
image: node
|
||||||
commands:
|
commands:
|
||||||
- (cd web && npm install && npm run build)
|
- (cd web && npm install && npm run build)
|
||||||
when:
|
when:
|
||||||
|
22
mumbleBot.py
22
mumbleBot.py
@ -131,8 +131,6 @@ class MumbleBot:
|
|||||||
self.join_channel()
|
self.join_channel()
|
||||||
self.mumble.set_bandwidth(self.bandwidth)
|
self.mumble.set_bandwidth(self.bandwidth)
|
||||||
|
|
||||||
self._user_in_channel = self.get_user_count_in_channel()
|
|
||||||
|
|
||||||
# ====== Volume ======
|
# ====== Volume ======
|
||||||
self.volume_helper = util.VolumeHelper()
|
self.volume_helper = util.VolumeHelper()
|
||||||
|
|
||||||
@ -353,34 +351,28 @@ class MumbleBot:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# =======================
|
# =======================
|
||||||
# Other Mumble Events
|
# Users changed
|
||||||
# =======================
|
# =======================
|
||||||
|
|
||||||
def get_user_count_in_channel(self):
|
|
||||||
own_channel = self.mumble.channels[self.mumble.users.myself['channel_id']]
|
|
||||||
return len(own_channel.get_users())
|
|
||||||
|
|
||||||
def users_changed(self, user, message):
|
def users_changed(self, user, message):
|
||||||
|
own_channel = self.mumble.channels[self.mumble.users.myself['channel_id']]
|
||||||
# only check if there is one more user currently in the channel
|
# only check if there is one more user currently in the channel
|
||||||
# else when the music is paused and somebody joins, music would start playing again
|
# else when the music is paused and somebody joins, music would start playing again
|
||||||
user_count = self.get_user_count_in_channel()
|
if len(own_channel.get_users()) == 2:
|
||||||
|
|
||||||
if user_count > self._user_in_channel and user_count == 2:
|
|
||||||
if var.config.get("bot", "when_nobody_in_channel") == "pause_resume":
|
if var.config.get("bot", "when_nobody_in_channel") == "pause_resume":
|
||||||
self.resume()
|
self.resume()
|
||||||
elif var.config.get("bot", "when_nobody_in_channel") == "pause" and self.is_pause:
|
elif var.config.get("bot", "when_nobody_in_channel") == "pause" and self.is_pause:
|
||||||
self.send_channel_msg(tr("auto_paused"))
|
self.send_channel_msg(tr("auto_paused"))
|
||||||
elif user_count == 1 and len(var.playlist) != 0:
|
|
||||||
|
elif len(own_channel.get_users()) == 1 and len(var.playlist) != 0:
|
||||||
# if the bot is the only user left in the channel and the playlist isn't empty
|
# if the bot is the only user left in the channel and the playlist isn't empty
|
||||||
|
self.log.info('bot: Other users in the channel left. Stopping music now.')
|
||||||
|
|
||||||
if var.config.get("bot", "when_nobody_in_channel") == "stop":
|
if var.config.get("bot", "when_nobody_in_channel") == "stop":
|
||||||
self.log.info('bot: No user in my channel. Stop music now.')
|
|
||||||
self.clear()
|
self.clear()
|
||||||
else:
|
else:
|
||||||
self.log.info('bot: No user in my channel. Pause music now.')
|
|
||||||
self.pause()
|
self.pause()
|
||||||
|
|
||||||
self._user_in_channel = user_count
|
|
||||||
|
|
||||||
# =======================
|
# =======================
|
||||||
# Launch and Download
|
# Launch and Download
|
||||||
# =======================
|
# =======================
|
||||||
|
Loading…
Reference in New Issue
Block a user