Compare commits
2 commits
1d666a569c
...
5603b88959
Author | SHA1 | Date | |
---|---|---|---|
5603b88959 | |||
7a9692b50c |
2 changed files with 6 additions and 10 deletions
|
@ -329,7 +329,6 @@ class Moderation(commands.Cog):
|
||||||
resolved_user = await self.fetch_user_dict(interaction, case_dict['resolved_by'])
|
resolved_user = await self.fetch_user_dict(interaction, case_dict['resolved_by'])
|
||||||
resolved_name = resolved_user['name'] if resolved_user['discriminator'] == "0" else f"{resolved_user['name']}#{resolved_user['discriminator']}"
|
resolved_name = resolved_user['name'] if resolved_user['discriminator'] == "0" else f"{resolved_user['name']}#{resolved_user['discriminator']}"
|
||||||
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n```{case_dict['resolve_reason']}```", inline=False)
|
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n```{case_dict['resolve_reason']}```", inline=False)
|
||||||
return embed
|
|
||||||
else:
|
else:
|
||||||
target_user = await self.fetch_user_dict(interaction, case_dict['target_id'])
|
target_user = await self.fetch_user_dict(interaction, case_dict['target_id'])
|
||||||
moderator_user = await self.fetch_user_dict(interaction, case_dict['moderator_id'])
|
moderator_user = await self.fetch_user_dict(interaction, case_dict['moderator_id'])
|
||||||
|
@ -341,7 +340,7 @@ class Moderation(commands.Cog):
|
||||||
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
|
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
|
||||||
embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>"
|
embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>"
|
||||||
embed.add_field(name='Reason', value=f"```{case_dict['reason']}```", inline=False)
|
embed.add_field(name='Reason', value=f"```{case_dict['reason']}```", inline=False)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
raise(TypeError("'type' argument is invalid!"))
|
raise(TypeError("'type' argument is invalid!"))
|
||||||
|
|
||||||
|
@ -902,7 +901,7 @@ class Moderation(commands.Cog):
|
||||||
await ctx.send(f"Logging channel set to {channel.mention}.")
|
await ctx.send(f"Logging channel set to {channel.mention}.")
|
||||||
else:
|
else:
|
||||||
await self.config.guild(ctx.guild).log_channel.set(" ")
|
await self.config.guild(ctx.guild).log_channel.set(" ")
|
||||||
await ctx.send(f"Logging channel disabled.")
|
await ctx.send("Logging channel disabled.")
|
||||||
|
|
||||||
@moderationset.command(name="mysql")
|
@moderationset.command(name="mysql")
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
|
|
|
@ -60,9 +60,9 @@ class YouTubeDownloader(commands.Cog):
|
||||||
try:
|
try:
|
||||||
self.blacklist_checker(ctx.author.id)
|
self.blacklist_checker(ctx.author.id)
|
||||||
except self.UserBlacklisted:
|
except self.UserBlacklisted:
|
||||||
await ctx.send(f"You are blacklisted from running this command!")
|
await ctx.send("You are blacklisted from running this command!")
|
||||||
return
|
return
|
||||||
def youtube_download(self, url: str, path: str):
|
def youtube_download(url: str, path: str):
|
||||||
"""This function does the actual downloading of the YouTube Video."""
|
"""This function does the actual downloading of the YouTube Video."""
|
||||||
yt = YouTube(url=url)
|
yt = YouTube(url=url)
|
||||||
filename = f"{yt.title} ({yt.video_id})"
|
filename = f"{yt.title} ({yt.video_id})"
|
||||||
|
@ -74,10 +74,7 @@ class YouTubeDownloader(commands.Cog):
|
||||||
stream = yt.streams.filter(progressive=True, mime_type='video/mp4')
|
stream = yt.streams.filter(progressive=True, mime_type='video/mp4')
|
||||||
stream = stream.order_by('resolution')
|
stream = stream.order_by('resolution')
|
||||||
filename_format = filename + ".mp4"
|
filename_format = filename + ".mp4"
|
||||||
if os.path.isfile(path + f"{os.sep}{filename_format}"):
|
previously_existed = bool(os.path.isfile(path + f"{os.sep}{filename_format}"))
|
||||||
previously_existed = True
|
|
||||||
else:
|
|
||||||
previously_existed = False
|
|
||||||
return stream.desc().first().download(filename=filename, output_path=path), previously_existed, filename_format
|
return stream.desc().first().download(filename=filename, output_path=path), previously_existed, filename_format
|
||||||
data_path = await self.config.save_directory()
|
data_path = await self.config.save_directory()
|
||||||
if subfolder and await self.bot.is_owner(ctx.author):
|
if subfolder and await self.bot.is_owner(ctx.author):
|
||||||
|
@ -108,7 +105,7 @@ class YouTubeDownloader(commands.Cog):
|
||||||
msg = ctx.send
|
msg = ctx.send
|
||||||
message = await msg("YouTube Downloader started!")
|
message = await msg("YouTube Downloader started!")
|
||||||
try:
|
try:
|
||||||
output = youtube_download(self, url, data_path)
|
output = youtube_download(url, data_path)
|
||||||
except exceptions.RegexMatchError:
|
except exceptions.RegexMatchError:
|
||||||
await message.edit(content="Please provide a link to YouTube and not another site.")
|
await message.edit(content="Please provide a link to YouTube and not another site.")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue