mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-14 08:02:17 +00:00
Further cleanup to make Deepsource happy
This commit is contained in:
parent
42a41509c5
commit
dae2d4901c
5 changed files with 21 additions and 19 deletions
|
@ -17,12 +17,14 @@ class Animals(commands.Cog):
|
||||||
animal_choice = animal_choice.lower().strip() or None
|
animal_choice = animal_choice.lower().strip() or None
|
||||||
|
|
||||||
if not animal_choice:
|
if not animal_choice:
|
||||||
error = f"You need to specify an animal! Try one of these: {', '.join(TINYFOX_ANIMALS)}"
|
error = f"You need to specify an animal! " \
|
||||||
|
f"Try one of these: {', '.join(TINYFOX_ANIMALS)}"
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
if animal_choice not in TINYFOX_ANIMALS:
|
if animal_choice not in TINYFOX_ANIMALS:
|
||||||
error = f"That animal doesn't exist! Try one of these: {', '.join(TINYFOX_ANIMALS)}"
|
error = f"That animal doesn't exist! " \
|
||||||
|
f"Try one of these: {', '.join(TINYFOX_ANIMALS)}"
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ class Help(commands.Cog):
|
||||||
"play <url>": "Play a song from YouTube, SoundCloud, etc.",
|
"play <url>": "Play a song from YouTube, SoundCloud, etc.",
|
||||||
"stop": "Stop the current song and leave the voice channel",
|
"stop": "Stop the current song and leave the voice channel",
|
||||||
"animal <animal>": "Get a random image of an animal!",
|
"animal <animal>": "Get a random image of an animal!",
|
||||||
"overlay <image> <style>": "Overlay an image with a style, e.g. `bubble mask`",
|
"overlay <image> <style>": "Overlay an image with a "
|
||||||
|
"style, e.g. `bubble mask`",
|
||||||
"saveable": "Turn image into a GIF to save within Discord",
|
"saveable": "Turn image into a GIF to save within Discord",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,15 @@ class Img(commands.Cog):
|
||||||
|
|
||||||
if not overlay_choice or overlay_choice not in IMAGE_OVERLAYS:
|
if not overlay_choice or overlay_choice not in IMAGE_OVERLAYS:
|
||||||
error = (
|
error = (
|
||||||
f"Invalid overlay choice! Use one of these: {', '.join(IMAGE_OVERLAYS)}"
|
f"Invalid overlay choice! Use one of "
|
||||||
|
f"these: {', '.join(IMAGE_OVERLAYS)}"
|
||||||
)
|
)
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
if overlay_style not in IMAGE_OVERLAYS[overlay_choice]["options"]:
|
if overlay_style not in IMAGE_OVERLAYS[overlay_choice]["options"]:
|
||||||
error = f"{overlay_choice} has these options: {', '.join(IMAGE_OVERLAYS[overlay_choice]['options'])}"
|
error = f"{overlay_choice} has these " \
|
||||||
|
f"options: {', '.join(IMAGE_OVERLAYS[overlay_choice]['options'])}"
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -73,7 +75,8 @@ class Img(commands.Cog):
|
||||||
).lower()
|
).lower()
|
||||||
file_extension = file_name.split(".")[-1]
|
file_extension = file_name.split(".")[-1]
|
||||||
if file_extension not in IMAGE_EXTENSIONS:
|
if file_extension not in IMAGE_EXTENSIONS:
|
||||||
error = f"Unsupported file type! Use one of these: {', '.join(IMAGE_EXTENSIONS)}"
|
error = f"Unsupported file type! Use one " \
|
||||||
|
f"of these: {', '.join(IMAGE_EXTENSIONS)}"
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -188,7 +191,8 @@ class Img(commands.Cog):
|
||||||
).lower()
|
).lower()
|
||||||
file_extension = file_name.split(".")[-1]
|
file_extension = file_name.split(".")[-1]
|
||||||
if file_extension not in IMAGE_EXTENSIONS:
|
if file_extension not in IMAGE_EXTENSIONS:
|
||||||
error = f"Unsupported file type! Use one of these: {', '.join(IMAGE_EXTENSIONS)}"
|
error = f"Unsupported file type! Use one " \
|
||||||
|
f"of these: {', '.join(IMAGE_EXTENSIONS)}"
|
||||||
await ctx.reply(embed=error_message(error))
|
await ctx.reply(embed=error_message(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,13 @@ class Music(commands.Cog):
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def play(self, ctx, *, url):
|
async def play(self, ctx, *, url):
|
||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
try:
|
song_info = ytdl.extract_info(url, download=False)
|
||||||
song_info = ytdl.extract_info(url, download=False)
|
ctx.voice_client.play(
|
||||||
ctx.voice_client.play(
|
discord.FFmpegPCMAudio(
|
||||||
discord.FFmpegPCMAudio(song_info["url"], **ffmpeg_options)
|
song_info["url"],
|
||||||
|
**ffmpeg_options
|
||||||
)
|
)
|
||||||
except Exception as err:
|
)
|
||||||
error = "An error occurred while processing this request." + str(err)
|
|
||||||
await ctx.reply(
|
|
||||||
embed=error_message(error),
|
|
||||||
mention_author=False,
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Now playing",
|
title="Now playing",
|
||||||
|
|
|
@ -17,7 +17,7 @@ LYNXIE_PREFIX = "?"
|
||||||
DATA_PATH = os.path.join("lynxie", "data")
|
DATA_PATH = os.path.join("lynxie", "data")
|
||||||
ASSETS_PATH = os.path.join("lynxie", "assets")
|
ASSETS_PATH = os.path.join("lynxie", "assets")
|
||||||
|
|
||||||
DATABASE_URI = f"sqlite:///" + os.path.join(DATA_PATH, "lynxie.db")
|
DATABASE_URI = "sqlite:///" + os.path.join(DATA_PATH, "lynxie.db")
|
||||||
|
|
||||||
|
|
||||||
# https://tinyfox.dev/docs/
|
# https://tinyfox.dev/docs/
|
||||||
|
|
Loading…
Add table
Reference in a new issue