yas
This commit is contained in:
parent
87759bd08f
commit
431c52dd2a
@ -8,19 +8,21 @@ class Voice(commands.Cog):
|
|||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
def qhandler(error=None,self=None, ctx=None, st=None):
|
def qhandler(error=None,self=None, ctx=None, st=None):
|
||||||
|
queue = (st.read("voice", "queue")).split("/./")
|
||||||
try:
|
try:
|
||||||
queue = (st.read("voice", "queue")).split("/./")
|
|
||||||
queue.pop(0)
|
queue.pop(0)
|
||||||
st.write("voice", "queue", "/./".join(queue))
|
except:
|
||||||
except ValueError:
|
pass
|
||||||
ctx.voice_client.stop()
|
st.write("voice", "queue", "/./".join(queue))
|
||||||
return
|
|
||||||
ffmpeg_options = {
|
ffmpeg_options = {
|
||||||
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
||||||
'options': '-vn'
|
'options': '-vn'
|
||||||
}
|
}
|
||||||
ctx.voice_client.play(discord.FFmpegPCMAudio(queue[0].get("url",None), **ffmpeg_options), after=self.qhandler(self, ctx))
|
if len(queue) > 0:
|
||||||
ctx.respond(f"Now playing: {queue[0].get('title',None)}")
|
ctx.voice_client.play(discord.FFmpegPCMAudio(queue[0]), **ffmpeg_options, after=self.qhandler(self, ctx))
|
||||||
|
ctx.respond(f"Now playing: {queue[0]}")
|
||||||
|
else:
|
||||||
|
ctx.voice_client.stop()
|
||||||
|
|
||||||
@bridge.bridge_command()
|
@bridge.bridge_command()
|
||||||
async def join(self, ctx):
|
async def join(self, ctx):
|
||||||
@ -61,7 +63,7 @@ class Voice(commands.Cog):
|
|||||||
if ctx.voice_client is None:
|
if ctx.voice_client is None:
|
||||||
channel = ctx.author.voice.channel
|
channel = ctx.author.voice.channel
|
||||||
await channel.connect()
|
await channel.connect()
|
||||||
if link == "":
|
if link == "" and ctx.voice_client.is_paused():
|
||||||
ctx.voice_client.resume()
|
ctx.voice_client.resume()
|
||||||
return
|
return
|
||||||
if ctx.voice_client.is_paused():
|
if ctx.voice_client.is_paused():
|
||||||
@ -101,8 +103,9 @@ class Voice(commands.Cog):
|
|||||||
await ctx.respond(f"Now playing: {video_title}")
|
await ctx.respond(f"Now playing: {video_title}")
|
||||||
else:
|
else:
|
||||||
queue = st.read("voice", "queue").split("/./")
|
queue = st.read("voice", "queue").split("/./")
|
||||||
queue.append(info_dict)
|
queue.append(info_dict.get("url",None))
|
||||||
st.write("voice", "queue", "/./".join(queue))
|
st.write("voice", "queue", "/./".join(queue))
|
||||||
|
await ctx.respond(f"Added to queue: {video_title}")
|
||||||
|
|
||||||
@bridge.bridge_command(alias=["stop"])
|
@bridge.bridge_command(alias=["stop"])
|
||||||
async def pause(self, ctx):
|
async def pause(self, ctx):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user