1
0
Fork 0
mirror of synced 2024-06-23 08:40:41 +12:00

Added an ETA message to estimate the next song in the queue that's yours

This commit is contained in:
Phxntxm 2016-08-06 08:09:24 -05:00
parent 23f01d0e1c
commit 3eb79a073b

View file

@ -217,6 +217,34 @@ class Music:
await state.voice.disconnect()
except:
pass
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole(send_messages=True)
async def eta(self, ctx):
"""Provides an ETA on when your next song will play"""
state = self.get_voice_state(ctx.message.server)
author = ctx.message.author
if not state.is_playing():
await self.bot.say('Not playing any music right now...')
return
if len(state.songs._queue) == 0:
await self.bot.say("Nothing currently in the queue")
return
count = state.current.duration
found = False
for song in state.songs._queue:
if song.requester == author:
found = True
break
count += song.player.duration
if count == state.current.duration:
await self.bot.say("You are next in the queue!")
return
if not found:
await self.bot.say("You are not in the queue!")
return
await self.bot.say("ETA till your next play is: {0[0]}m {0[1]}s]".format(divmod(round(count, 0), 60)))
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole(send_messages=True)