1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Handle when there are no songs in the queue

This commit is contained in:
phxntxm 2017-05-29 16:27:12 -05:00
parent 74896d921e
commit d5b1f0a64d

View file

@ -527,8 +527,11 @@ class Music:
@utils.custom_perms(send_messages=True)
async def queuelength(self, ctx):
"""Prints the length of the queue"""
await ctx.send("There are a total of {} songs in the queue"
.format(len(self.voice_states.get(ctx.message.guild.id).songs.entries)))
state = self.voice_states.get(ctx.message.guild.id)
if state:
await ctx.send("There are a total of {} songs in the queue".format(len(state.songs.entries)))
else:
await ctx.send("There are no songs in the queue")
@commands.command(pass_context=True)
@commands.guild_only()