mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-14 08:02:17 +00:00
Merge pull request #4 from Fluffy-Bean/deepsource-transform-9645750f
format code with black
This commit is contained in:
commit
68d638c7ee
4 changed files with 50 additions and 32 deletions
|
@ -27,10 +27,7 @@ async def on_ready():
|
||||||
|
|
||||||
@lynxie.event
|
@lynxie.event
|
||||||
async def on_command(ctx):
|
async def on_command(ctx):
|
||||||
if (
|
if ctx.author == lynxie.user or ctx.author.bot:
|
||||||
ctx.author == lynxie.user or
|
|
||||||
ctx.author.bot
|
|
||||||
):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
query = CommandHistory(
|
query = CommandHistory(
|
||||||
|
@ -45,18 +42,17 @@ async def on_command(ctx):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@lynxie.event
|
@lynxie.event
|
||||||
async def on_message_edit(before, after):
|
async def on_message_edit(before, after):
|
||||||
if (
|
if (
|
||||||
before.author == lynxie.user or
|
before.author == lynxie.user
|
||||||
before.author.bot or
|
or before.author.bot
|
||||||
before.content == after.content
|
or before.content == after.content
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
await before.channel.send(
|
await before.channel.send(
|
||||||
f'@{before.author} edited their message!!!\n'
|
f"@{before.author} edited their message!!!\n"
|
||||||
f'"{before.content}" --> "{after.content}"'
|
f'"{before.content}" --> "{after.content}"'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ class Animals(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def animal(self, ctx, animal):
|
async def animal(self, ctx, animal):
|
||||||
animal = animal.lower().strip() or "racc"
|
animal = animal.lower().strip() or "racc"
|
||||||
|
@ -28,7 +27,9 @@ class Animals(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
animal_image_request = requests.get(f"https://api.tinyfox.dev/img?animal={animal}").content
|
animal_image_request = requests.get(
|
||||||
|
f"https://api.tinyfox.dev/img?animal={animal}"
|
||||||
|
).content
|
||||||
animal_image = BytesIO(animal_image_request)
|
animal_image = BytesIO(animal_image_request)
|
||||||
animal_image.seek(0)
|
animal_image.seek(0)
|
||||||
animal_file = discord.File(animal_image, filename=animal_filename)
|
animal_file = discord.File(animal_image, filename=animal_filename)
|
||||||
|
@ -37,12 +38,6 @@ class Animals(commands.Cog):
|
||||||
title="Animal",
|
title="Animal",
|
||||||
description=f"Here's a random {animal}!",
|
description=f"Here's a random {animal}!",
|
||||||
colour=discord.Colour.orange(),
|
colour=discord.Colour.orange(),
|
||||||
).set_image(
|
).set_image(url="attachment://" + animal_filename)
|
||||||
url="attachment://" + animal_filename
|
|
||||||
)
|
|
||||||
|
|
||||||
await ctx.reply(
|
await ctx.reply(embed=embed, file=animal_file, mention_author=False)
|
||||||
embed=embed,
|
|
||||||
file=animal_file,
|
|
||||||
mention_author=False
|
|
||||||
)
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ from discord.ext import commands
|
||||||
from lynxie.utils import error_message
|
from lynxie.utils import error_message
|
||||||
|
|
||||||
|
|
||||||
ffmpeg_options = {'options': '-vn'}
|
ffmpeg_options = {"options": "-vn"}
|
||||||
ydl_opts = {'format': 'bestaudio'}
|
ydl_opts = {"format": "bestaudio"}
|
||||||
ytdl = yt_dlp.YoutubeDL(ydl_opts)
|
ytdl = yt_dlp.YoutubeDL(ydl_opts)
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,13 +25,15 @@ class Music(commands.Cog):
|
||||||
try:
|
try:
|
||||||
song_info = ytdl.extract_info(url, download=False)
|
song_info = ytdl.extract_info(url, download=False)
|
||||||
print(song_info["url"])
|
print(song_info["url"])
|
||||||
ctx.voice_client.play(discord.FFmpegPCMAudio(song_info["url"], **ffmpeg_options))
|
ctx.voice_client.play(
|
||||||
|
discord.FFmpegPCMAudio(song_info["url"], **ffmpeg_options)
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
embed=error_message(
|
embed=error_message(
|
||||||
"An error occurred while processing this request."
|
"An error occurred while processing this request."
|
||||||
),
|
),
|
||||||
mention_author=False
|
mention_author=False,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ class Music(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
embed=error_message("You are not connected to a voice channel!"),
|
embed=error_message("You are not connected to a voice channel!"),
|
||||||
mention_author=False
|
mention_author=False,
|
||||||
)
|
)
|
||||||
elif ctx.voice_client.is_playing():
|
elif ctx.voice_client.is_playing():
|
||||||
ctx.voice_client.stop()
|
ctx.voice_client.stop()
|
||||||
|
|
|
@ -11,9 +11,34 @@ DISCORD_GUILD_ID = Object(id=1040757387033849976)
|
||||||
DISCORD_TOKEN = get_env_or_error("DISCORD_TOKEN")
|
DISCORD_TOKEN = get_env_or_error("DISCORD_TOKEN")
|
||||||
|
|
||||||
TINYFOX_ANIMALS = [
|
TINYFOX_ANIMALS = [
|
||||||
"chi", "bear", "dog", "capy", "caracal", "chee",
|
"chi",
|
||||||
"yote", "bleat", "dook", "fox", "yeen", "jaguar",
|
"bear",
|
||||||
"leo", "lynx", "mane", "puma", "poss", "ott",
|
"dog",
|
||||||
"manul", "marten", "bun", "racc", "wah", "serval",
|
"capy",
|
||||||
"shiba", "skunk", "snek", "snep", "tig", "woof",
|
"caracal",
|
||||||
|
"chee",
|
||||||
|
"yote",
|
||||||
|
"bleat",
|
||||||
|
"dook",
|
||||||
|
"fox",
|
||||||
|
"yeen",
|
||||||
|
"jaguar",
|
||||||
|
"leo",
|
||||||
|
"lynx",
|
||||||
|
"mane",
|
||||||
|
"puma",
|
||||||
|
"poss",
|
||||||
|
"ott",
|
||||||
|
"manul",
|
||||||
|
"marten",
|
||||||
|
"bun",
|
||||||
|
"racc",
|
||||||
|
"wah",
|
||||||
|
"serval",
|
||||||
|
"shiba",
|
||||||
|
"skunk",
|
||||||
|
"snek",
|
||||||
|
"snep",
|
||||||
|
"tig",
|
||||||
|
"woof",
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue