shortened status message,
add queue peek comand, add pause and resume command
This commit is contained in:
parent
08f14235e9
commit
d7fb919fff
11
src/embed.py
11
src/embed.py
@ -2,6 +2,17 @@ import discord
|
|||||||
from pytube import YouTube
|
from pytube import YouTube
|
||||||
|
|
||||||
def get_status(channel, queue, playing):
|
def get_status(channel, queue, playing):
|
||||||
|
desc = 'playing {0} in {1}'.format(playing.title, channel)
|
||||||
|
emb = discord.Embed(title='music-bot', description=desc,color=0x0000FF)
|
||||||
|
if(queue.has_next()):
|
||||||
|
lst = "next up: {0}".format(queue.elem[0].title)
|
||||||
|
else:
|
||||||
|
lst = "empty queue"
|
||||||
|
emb.add_field(name="{0} tracks left in queue".format(queue.num_remaining()), value=lst)
|
||||||
|
emb.set_thumbnail(url=playing.thumbnail_url)
|
||||||
|
return emb
|
||||||
|
|
||||||
|
def get_queue(channel, queue, playing):
|
||||||
desc = 'playing {0} in {1}'.format(playing.title, channel)
|
desc = 'playing {0} in {1}'.format(playing.title, channel)
|
||||||
emb = discord.Embed(title='music-bot', description=desc,color=0x0000FF)
|
emb = discord.Embed(title='music-bot', description=desc,color=0x0000FF)
|
||||||
lst = ""
|
lst = ""
|
||||||
|
@ -227,4 +227,60 @@ async def search(ctx, *args):
|
|||||||
bot.previous_search = s.results
|
bot.previous_search = s.results
|
||||||
await ctx.send(embed=get_search_results(query, s.results))
|
await ctx.send(embed=get_search_results(query, s.results))
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
async def peek(ctx, *args):
|
||||||
|
|
||||||
|
roleid = bot.config['guild']['roleid']
|
||||||
|
prefix = bot.config['guild']['prefix']
|
||||||
|
|
||||||
|
if(len(args) != 0):
|
||||||
|
await ctx.send(embed=get_error("usage: {0}peek".format(prefix)))
|
||||||
|
return
|
||||||
|
elif(ctx.author.voice == None):
|
||||||
|
await ctx.send(embed=get_error("you are not in a voice channel"))
|
||||||
|
return
|
||||||
|
elif(roleid not in [role.id for role in ctx.author.roles]):
|
||||||
|
await ctx.send(embed=get_error("you do not have the role to play music"))
|
||||||
|
return
|
||||||
|
|
||||||
|
await ctx.send(embed=get_queue(ctx.voice_client.channel, bot.queue, bot.currently_playing))
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
async def pause(ctx, *args):
|
||||||
|
|
||||||
|
roleid = bot.config['guild']['roleid']
|
||||||
|
prefix = bot.config['guild']['prefix']
|
||||||
|
|
||||||
|
if(len(args) != 0):
|
||||||
|
await ctx.send(embed=get_error("usage: {0}pause".format(prefix)))
|
||||||
|
return
|
||||||
|
elif(ctx.author.voice == None):
|
||||||
|
await ctx.send(embed=get_error("you are not in a voice channel"))
|
||||||
|
return
|
||||||
|
elif(roleid not in [role.id for role in ctx.author.roles]):
|
||||||
|
await ctx.send(embed=get_error("you do not have the role to play music"))
|
||||||
|
return
|
||||||
|
|
||||||
|
ctx.voice_client.pause()
|
||||||
|
await ctx.send(embed=get_success("paused"))
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
async def resume(ctx, *args):
|
||||||
|
|
||||||
|
roleid = bot.config['guild']['roleid']
|
||||||
|
prefix = bot.config['guild']['prefix']
|
||||||
|
|
||||||
|
if(len(args) != 0):
|
||||||
|
await ctx.send(embed=get_error("usage: {0}resume".format(prefix)))
|
||||||
|
return
|
||||||
|
elif(ctx.author.voice == None):
|
||||||
|
await ctx.send(embed=get_error("you are not in a voice channel"))
|
||||||
|
return
|
||||||
|
elif(roleid not in [role.id for role in ctx.author.roles]):
|
||||||
|
await ctx.send(embed=get_error("you do not have the role to play music"))
|
||||||
|
return
|
||||||
|
|
||||||
|
ctx.voice_client.resume()
|
||||||
|
await ctx.send(embed=get_success("resumed"))
|
||||||
|
|
||||||
bot.run(token)
|
bot.run(token)
|
Loading…
Reference in New Issue
Block a user