Revert "!audioset status"

This reverts commit 497b13a0c4f2e0ff139c974d1f75cb3b3969775f.
This commit is contained in:
Will Tekulve 2016-06-13 22:38:27 -04:00
parent 9226c3c915
commit 01bbac480d

View File

@ -240,7 +240,6 @@ class Audio:
"VOTE_THRESHOLD"] "VOTE_THRESHOLD"]
self.cache_path = "data/audio/cache" self.cache_path = "data/audio/cache"
self.local_playlist_path = "data/audio/localtracks" self.local_playlist_path = "data/audio/localtracks"
self._old_game = False
def _add_to_queue(self, server, url): def _add_to_queue(self, server, url):
if server.id not in self.queue: if server.id not in self.queue:
@ -881,14 +880,13 @@ class Audio:
"QUEUE": deque(), "TEMP_QUEUE": deque(), "QUEUE": deque(), "TEMP_QUEUE": deque(),
"NOW_PLAYING": None} "NOW_PLAYING": None}
async def _stop(self, server): def _stop(self, server):
self._setup_queue(server) self._setup_queue(server)
self._stop_player(server) self._stop_player(server)
self._stop_downloader(server) self._stop_downloader(server)
await self.update_bot_status()
async def _stop_and_disconnect(self, server): async def _stop_and_disconnect(self, server):
await self._stop(server) self._stop(server)
await self._disconnect_voice_client(server) await self._disconnect_voice_client(server)
def _stop_downloader(self, server): def _stop_downloader(self, server):
@ -968,19 +966,6 @@ class Audio:
await self.bot.say("Player toggled. You're now using ffmpeg.") await self.bot.say("Player toggled. You're now using ffmpeg.")
self.save_settings() self.save_settings()
@audioset.command(name="status")
@checks.is_owner() # cause effect is cross-server
async def audioset_status(self):
"""Enables/disables songs' titles as status"""
self.settings["TITLE_STATUS"] = not self.settings["TITLE_STATUS"]
if self.settings["TITLE_STATUS"]:
await self.bot.say("If only one server is playing music, songs' titles will now show up as status")
else:
await self.bot.say("Songs' titles will no longer show up as status")
# doen't update for some reason. fix later.
await self.update_bot_status()
self.save_settings()
@audioset.command(pass_context=True, name="volume", no_pm=True) @audioset.command(pass_context=True, name="volume", no_pm=True)
@checks.mod_or_permissions(manage_messages=True) @checks.mod_or_permissions(manage_messages=True)
async def audioset_volume(self, ctx, percent: int): async def audioset_volume(self, ctx, percent: int):
@ -1078,7 +1063,7 @@ class Audio:
voice_channel = author.voice_channel voice_channel = author.voice_channel
if voice_channel is not None: if voice_channel is not None:
await self._stop(server) self._stop(server)
await self._join_voice_channel(voice_channel) await self._join_voice_channel(voice_channel)
@ -1598,7 +1583,7 @@ class Audio:
# TODO: All those fun checks for permissions # TODO: All those fun checks for permissions
server = ctx.message.server server = ctx.message.server
await self._stop(server) self._stop(server)
@commands.command(name="yt", pass_context=True, no_pm=True) @commands.command(name="yt", pass_context=True, no_pm=True)
async def yt_search(self, ctx, *, search_terms: str): async def yt_search(self, ctx, *, search_terms: str):
@ -1617,37 +1602,6 @@ class Audio:
return False return False
return True return True
def get_active_voice_clients(self):
avcs = []
for vc in self.bot.voice_clients:
if hasattr(vc, 'audio_player') and not vc.audio_player.is_done():
avcs.append(vc)
return avcs
# returns False if not changed.
async def update_bot_status(self):
if self.settings["TITLE_STATUS"]:
active_servers = self.get_active_voice_clients()
song = None
if len(active_servers) == 1:
server = active_servers[0].server.id
song = self.queue[server.id]["NOW_PLAYING"]
if song:
if self._old_game is False:
self._old_game = server.me.game
await self.bot.change_status(discord.Game(name=song.title))
elif self._old_game is not False: # self._old_game can be None. want to use it.
await self.bot.change_status(self._old_game)
self._old_game = False
else:
return False
elif self._old_game is not False: # self._old_game can be None. want to use it.
await self.bot.change_status(self._old_game)
self._old_game = False
else:
return False
return True
async def cache_manager(self): async def cache_manager(self):
while self == self.bot.get_cog("Audio"): while self == self.bot.get_cog("Audio"):
if self._cache_too_large(): if self._cache_too_large():
@ -1773,8 +1727,6 @@ class Audio:
song = None song = None
self.queue[server.id]["NOW_PLAYING"] = song self.queue[server.id]["NOW_PLAYING"] = song
log.debug("set now_playing for sid {}".format(server.id)) log.debug("set now_playing for sid {}".format(server.id))
await self.update_bot_status()
elif server.id in self.downloaders: elif server.id in self.downloaders:
# We're playing but we might be able to download a new song # We're playing but we might be able to download a new song
curr_dl = self.downloaders.get(server.id) curr_dl = self.downloaders.get(server.id)