diff --git a/lynxie/__main__.py b/lynxie/__main__.py index b7ca5f2..5e04edb 100644 --- a/lynxie/__main__.py +++ b/lynxie/__main__.py @@ -3,19 +3,18 @@ import asyncio import discord from discord.ext import commands -from lynxie.config import DISCORD_TOKEN, LYNXIE_PREFIX, LYNXIE_DB -from lynxie.commands import Help, Ping, Hello, Music, Animals +from lynxie.config import DISCORD_TOKEN, LYNXIE_PREFIX +from lynxie.commands import Help, Ping, Hello, Music, Animals, Img from lynxie.database import CommandHistory, Database +db = Database() lynxie = commands.Bot( intents=discord.Intents.all(), command_prefix=LYNXIE_PREFIX, help_command=None, ) -db = Database() - @lynxie.event async def on_ready(): @@ -56,8 +55,6 @@ async def on_message_edit(before, after): f'"{before.content}" --> "{after.content}"' ) - # await lynxie.process_commands(after) - async def run(): async with lynxie: @@ -66,6 +63,7 @@ async def run(): await lynxie.add_cog(Hello(lynxie)) await lynxie.add_cog(Music(lynxie)) await lynxie.add_cog(Animals(lynxie)) + await lynxie.add_cog(Img(lynxie)) await lynxie.start(DISCORD_TOKEN) diff --git a/lynxie/assets/bubble.png b/lynxie/assets/bubble.png new file mode 100644 index 0000000..c31319c Binary files /dev/null and b/lynxie/assets/bubble.png differ diff --git a/lynxie/assets/gang.png b/lynxie/assets/gang.png new file mode 100644 index 0000000..530a729 Binary files /dev/null and b/lynxie/assets/gang.png differ diff --git a/lynxie/commands/__init__.py b/lynxie/commands/__init__.py index d77e2f8..98dcd98 100644 --- a/lynxie/commands/__init__.py +++ b/lynxie/commands/__init__.py @@ -3,6 +3,7 @@ from .ping import Ping from .hello import Hello from .music import Music from .animals import Animals +from .image import Img __all__ = [ "Help", @@ -10,4 +11,5 @@ __all__ = [ "Hello", "Music", "Animals", + "Img", ] diff --git a/lynxie/commands/animals.py b/lynxie/commands/animals.py index e78735c..4b1b74b 100644 --- a/lynxie/commands/animals.py +++ b/lynxie/commands/animals.py @@ -15,7 +15,6 @@ class Animals(commands.Cog): @commands.command() async def animal(self, ctx, animal): animal = animal.lower().strip() or "racc" - animal_filename = f"{animal}.png" if animal not in TINYFOX_ANIMALS: await ctx.reply( @@ -27,17 +26,16 @@ class Animals(commands.Cog): return async with ctx.typing(): - animal_image_request = requests.get( - f"https://api.tinyfox.dev/img?animal={animal}" - ).content - animal_image = BytesIO(animal_image_request) + request = requests.get(f"https://api.tinyfox.dev/img?animal={animal}&json") + animal_image = BytesIO(request.content) animal_image.seek(0) - animal_file = discord.File(animal_image, filename=animal_filename) + animal_file = discord.File(animal_image, filename="image.png") embed = discord.Embed( - title="Animal", - description=f"Here's a random {animal}!", + title=animal.capitalize(), colour=discord.Colour.orange(), - ).set_image(url="attachment://" + animal_filename) + ).set_image( + url="attachment://image.png" + ) await ctx.reply(embed=embed, file=animal_file, mention_author=False) diff --git a/lynxie/commands/help.py b/lynxie/commands/help.py index 618c9fb..4b654cd 100644 --- a/lynxie/commands/help.py +++ b/lynxie/commands/help.py @@ -13,7 +13,8 @@ class Help(commands.Cog): "join": "Join the voice channel you're in", "play ": "Play a song from YouTube, SoundCloud, etc.", "stop": "Stop the current song and leave the voice channel", - "e621": "Search e621.net", + "animal ": "Get a random image of an animal!", + "overlay