some behaviors & multiword sfx

added some of the music control behaviors

quotes now not needed for multiword sfx
This commit is contained in:
Irdumb 2016-04-10 08:32:14 +10:00
parent 607cde76f4
commit 54dc976f3a

View File

@ -148,6 +148,8 @@ class Audio:
self.music_player.stop() self.music_player.stop()
else: else:
await self.vote_skip(msg) await self.vote_skip(msg)
elif self.sfx_player.is_playing():
self.sfx_player.stop()
async def vote_skip(self, msg): async def vote_skip(self, msg):
v_channel = msg.server.me.voice_channel v_channel = msg.server.me.voice_channel
@ -211,7 +213,7 @@ class Audio:
await self.bot.say("There are no valid playlists in the localtracks folder.\nIf you're the owner, see {}".format(help_link)) await self.bot.say("There are no valid playlists in the localtracks folder.\nIf you're the owner, see {}".format(help_link))
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
async def sfx(self, ctx, name : str): async def sfx(self, ctx, *, name : str):
"""Plays a local sound file """Plays a local sound file
For bot's owner: For bot's owner:
@ -337,8 +339,8 @@ class Audio:
self.queue = [] self.queue = []
self.playlist = [] self.playlist = []
self.current = -1 self.current = -1
if self.music_player.is_playing(): self.music_player.stop() if not self.music_player.is_done(): self.music_player.stop()
if self.sfx_player.is_playing(): self.sfx_player.stop() if not self.sfx_player.is_done(): self.sfx_player.stop()
await asyncio.sleep(1) await asyncio.sleep(1)
if self.bot.voice: await self.bot.voice.disconnect() if self.bot.voice: await self.bot.voice.disconnect()
@ -421,7 +423,9 @@ class Audio:
@commands.command() @commands.command()
async def resume(self): async def resume(self):
"""Resumes paused song.""" """Resumes paused song."""
if not self.music_player.is_playing(): if self.sfx_player.is_playing():
self.sfx_player.stop()
elif not self.music_player.is_playing():
self.music_player.paused = False self.music_player.paused = False
self.music_player.resume() self.music_player.resume()
await self.bot.say("Resuming song.") await self.bot.say("Resuming song.")