Added an ETA message to estimate the next song in the queue that's yours
This commit is contained in:
parent
23f01d0e1c
commit
3eb79a073b
1 changed files with 28 additions and 0 deletions
|
@ -217,6 +217,34 @@ class Music:
|
||||||
await state.voice.disconnect()
|
await state.voice.disconnect()
|
||||||
except:
|
except:
|
||||||
pass
|
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)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@checks.customPermsOrRole(send_messages=True)
|
@checks.customPermsOrRole(send_messages=True)
|
||||||
|
|
Loading…
Reference in a new issue