Skip to content

Commit

Permalink
Merge pull request #21 from khanjason/Development
Browse files Browse the repository at this point in the history
youtubedl error msg
  • Loading branch information
khanjason authored Nov 30, 2020
2 parents a7730e2 + 268c46f commit 4a3b565
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions cogs/Chair.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import defaultdict
from discord.ext import commands, tasks
from discord.utils import get
from youtube_dl import YoutubeDL
from youtube_dl import YoutubeDL, utils
class Chair(commands.Cog):
def __init__(self, bot):
self.bot = bot
Expand Down Expand Up @@ -195,10 +195,14 @@ def check(message):
}],
'outtmpl': 'song.%(ext)s',
}
with YoutubeDL(YDL_OPTIONS) as ydl:
ydl.download([url])
voice_client.play(FFmpegPCMAudio("song.mp3"))
voice_client.is_playing()
try:
with YoutubeDL(YDL_OPTIONS) as ydl:
ydl.download([url])
voice_client.play(FFmpegPCMAudio("song.mp3"))
voice_client.is_playing()
except utils.DownloadError:
embedVar = discord.Embed(title="Error", description="YoutubeDL failed to download Gavel Sound Effect.", color=discord.Color.from_rgb(78,134,219))
m= await ctx.channel.send(embed=embedVar)



Expand Down Expand Up @@ -236,10 +240,15 @@ def check(message):
}],
'outtmpl': 'song.%(ext)s',
}
with YoutubeDL(YDL_OPTIONS) as ydl:
ydl.download([url])
voice_client.play(FFmpegPCMAudio("song.mp3"))
voice_client.is_playing()
try:
with YoutubeDL(YDL_OPTIONS) as ydl:
ydl.download([url])
voice_client.play(FFmpegPCMAudio("song.mp3"))
voice_client.is_playing()

except utils.DownloadError:
embedVar = discord.Embed(title="Error", description="YoutubeDL failed to download Gavel Sound Effect.", color=discord.Color.from_rgb(78,134,219))
m= await ctx.channel.send(embed=embedVar)
@commands.has_role('Chair')
@commands.command(pass_context=True,brief='Register a delegate.', description='Requires !register [delegate name] [status].\n Status can be present (p),present and voting(pv) or absent (a)')
async def register(self,ctx,*,args):
Expand Down

0 comments on commit 4a3b565

Please sign in to comment.