diff --git a/bot.py b/bot.py index dd0dd33..5bd7023 100644 --- a/bot.py +++ b/bot.py @@ -11,6 +11,8 @@ class Korii(commands.AutoShardedBot): + user: discord.ClientUser + def __init__(self) -> None: super().__init__( command_prefix=commands.when_mentioned_or("s!"), diff --git a/extensions/events/avatars.py b/extensions/events/avatars.py index a9f201b..1417ef4 100644 --- a/extensions/events/avatars.py +++ b/extensions/events/avatars.py @@ -28,7 +28,7 @@ async def update_avatars(self): if self.developers_role in member.roles: assert member.avatar await self.bot.pool.execute("INSERT INTO avatars(user_id, avatar_url) VALUES ($1, $2) ON CONFLICT(user_id) DO UPDATE SET avatar_url = $2", - member.id, member.avatar.replace(size=256, format="webp")) + member.id, member.avatar.replace(size=256, format="webp").url) @update_avatars.before_loop async def wait_until_ready(self): diff --git a/extensions/fun/animals.py b/extensions/fun/animals.py index 7b8e041..d1b630c 100644 --- a/extensions/fun/animals.py +++ b/extensions/fun/animals.py @@ -5,7 +5,8 @@ from discord.app_commands import Choice from discord.ext import commands -from utils import Embed, Interaction, Korii +from utils import Embed, Interaction +from bot import Korii class AnimalsCog(commands.Cog): diff --git a/extensions/images/jeyy_api.py b/extensions/images/jeyy_api.py index 841c913..73f13e5 100644 --- a/extensions/images/jeyy_api.py +++ b/extensions/images/jeyy_api.py @@ -1,10 +1,11 @@ import io -from typing import Literal, Optional +from typing import Optional import discord from discord import app_commands from discord.ext import commands, tasks +from discord.app_commands import Choice import config from utils import Interaction, Korii @@ -45,411 +46,10 @@ async def send_embed(self, interaction: Interaction, endpoint: str, url: str, ep Choice(name='banana', value=2), Choice(name='cherry', value=3), ]) - async def image(self, interaction: Interaction, type: endpoints, user: Optional[discord.Member] = None): + async def images(self, interaction: Interaction, type: ..., user: Optional[discord.Member] = None): assert isinstance(interaction.user, discord.Member) if not user: user = interaction.user - ... - - - - @images.command(description="Turn the specified user's profile picture into a pyramid.") - @app_commands.describe(user="The user's profile picture you want to turn into a pyramid.") - @app_commands.guild_only() - async def pyramid( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="pyramid", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Glitch the specified user's profile picture.") - @app_commands.describe(user="The user you want to glitch the profile picture of.") - @app_commands.guild_only() - async def glitch( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="glitch", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Put an earthquake over the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to add an earthquake effect on.") - @app_commands.guild_only() - async def earthquake( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="earthquake", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Pats the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to pat.") - @app_commands.guild_only() - async def patpat( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="patpat", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Burn the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to burn.") - @app_commands.guild_only() - async def burn( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="burn", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Explode the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to explode.") - @app_commands.guild_only() - async def bomb( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="bomb", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Add an explicit caption over the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to add an explicit caption over.") - @app_commands.guild_only() - async def explicit( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="explicit", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Bonk the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to bonk.") - @app_commands.guild_only() - async def bonk( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="bonks", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Rain over the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to rain over.") - @app_commands.guild_only() - async def rain( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="rain", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Shoot the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to shoot.") - @app_commands.guild_only() - async def shoot( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="shoot", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Print the specified user's profile picture.") - @app_commands.describe(user="The user's profile picture you want to print.") - @app_commands.guild_only() - async def print( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="print", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Turn the specified user's profile picture into a matrix.") - @app_commands.describe(user="The user's profile picture you want to turn into a matrix.") - @app_commands.guild_only() - async def matrix( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="matrix", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Watch the user's profile picture on TV.") - @app_commands.describe(user="The user's profile picture you want to watch on TV.") - @app_commands.guild_only() - async def tv( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="tv", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Put the specified user's profile picture in a laundry machine.") - @app_commands.describe(user="The user's profile picture you want to put in a laundry machine.") - @app_commands.guild_only() - async def laundry( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="laundry", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Turn the specified user's profile picture into a pizza.") - @app_commands.describe(user="The user's profile picture you want to turn into a pizza.") - @app_commands.guild_only() - async def pizza( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="pizza", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Shred the specified user's profile picture") - @app_commands.describe(user="The user's profile picture you want to shred.") - @app_commands.guild_only() - async def shred( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="shred", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Turn the specified user's profile picture into balls.") - @app_commands.describe(user="The user's profile picture you want to turn into balls.") - @app_commands.guild_only() - async def balls( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="balls", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Make the specified user's profile picture do complex equations.") - @app_commands.describe(user="The user's profile picture you want to do complex equations.") - @app_commands.guild_only() - async def equations( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="equations", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) - - @images.command(description="Turn the specified user's profile picture into a cow.") - @app_commands.describe(user="The user's profile picture you want to turn into a cow.") - @app_commands.guild_only() - async def cow( - self, - interaction: Interaction, - user: Optional[discord.Member] = None, - ephemeral: bool = False, - ): - assert isinstance(interaction.user, discord.Member) - - if not user: - user = interaction.user - - return await self.send_embed( - interaction=interaction, - endpoint="cow", - url=user.display_avatar.url, - ephemeral=ephemeral, - ) + ... \ No newline at end of file