aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorshrx <[email protected]>2016-03-01 15:23:46 +0100
committerRapptz <[email protected]>2016-03-02 23:24:04 -0500
commit8c4f928684fb377727feac279febb3f88e0c5563 (patch)
tree72a93cb92e0028cde73e33aa19d5c155cf4fee14 /examples
parent[commands] Fix NameError in bot_has_permissions. (diff)
downloaddiscord.py-8c4f928684fb377727feac279febb3f88e0c5563.tar.xz
discord.py-8c4f928684fb377727feac279febb3f88e0c5563.zip
Fix bug where playlist bot attempts to process replies in PMs.
Diffstat (limited to 'examples')
-rw-r--r--examples/playlist.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/playlist.py b/examples/playlist.py
index f3466378..7a7eea3e 100644
--- a/examples/playlist.py
+++ b/examples/playlist.py
@@ -39,42 +39,43 @@ class Bot(discord.Client):
if message.channel.is_private:
await self.send_message(message.channel, 'You cannot use this bot in private messages.')
- if message.content.startswith('$join'):
+ elif message.content.startswith('$join'):
if self.is_voice_connected():
await self.send_message(message.channel, 'Already connected to a voice channel')
channel_name = message.content[5:].strip()
check = lambda c: c.name == channel_name and c.type == discord.ChannelType.voice
-
channel = discord.utils.find(check, message.server.channels)
if channel is None:
await self.send_message(message.channel, 'Cannot find a voice channel by that name.')
-
- await self.join_voice_channel(channel)
- self.starter = message.author
+ else:
+ await self.join_voice_channel(channel)
+ self.starter = message.author
elif message.content.startswith('$leave'):
if not self.can_control_song(message.author):
return
self.starter = None
await self.voice.disconnect()
+
elif message.content.startswith('$pause'):
if not self.can_control_song(message.author):
fmt = 'Only the requester ({0.current.requester}) can control this song'
await self.send_message(message.channel, fmt.format(self))
-
- if self.player.is_playing():
+ elif self.player.is_playing():
self.player.pause()
+
elif message.content.startswith('$resume'):
if not self.can_control_song(message.author):
fmt = 'Only the requester ({0.current.requester}) can control this song'
await self.send_message(message.channel, fmt.format(self))
-
- if self.player is not None and not self.is_playing():
+ elif self.player is not None and not self.is_playing():
self.player.resume()
+
elif message.content.startswith('$next'):
filename = message.content[5:].strip()
await self.songs.put(VoiceEntry(message, filename))
await self.send_message(message.channel, 'Successfully registered {}'.format(filename))
+
elif message.content.startswith('$play'):
if self.player is not None and self.player.is_playing():
await self.send_message(message.channel, 'Already playing a song')
@@ -83,7 +84,6 @@ class Bot(discord.Client):
if not self.is_voice_connected():
await self.send_message(message.channel, 'Not connected to a voice channel')
return
-
self.play_next_song.clear()
self.current = await self.songs.get()
self.player = self.voice.create_ffmpeg_player(self.current.song, after=self.toggle_next_song)