diff --git a/bot.py b/bot.py index e5ccc79..e55f601 100644 --- a/bot.py +++ b/bot.py @@ -1,17 +1,18 @@ import logging import pathlib +from typing import List -import discord -import mystbin as mystbin_library import aiohttp import asyncpg +import discord +import mystbin as mystbin_library from discord.ext import commands + import config -from typing import List class Korii(commands.AutoShardedBot): - pool: asyncpg.Pool | None + pool: asyncpg.Pool user: discord.ClientUser owner_ids: List[int] @@ -102,7 +103,7 @@ async def load_extensions(self) -> None: return self.ext_logger.info(f"Loaded {success} out of {success + failed} extensions") async def setup_hook(self) -> None: - self.pool = await asyncpg.create_pool(config.DATABASE) + self.pool = await asyncpg.create_pool(config.DATABASE) # type: ignore if not self.pool: raise RuntimeError("Failed to connect with the database.") diff --git a/extensions/events/__init__.py b/extensions/events/__init__.py index ba6fa64..690fa05 100644 --- a/extensions/events/__init__.py +++ b/extensions/events/__init__.py @@ -1,7 +1,7 @@ -from .guild import GuildCog -from .ping import PingCog from .errors import ErrorsCog from .ghost import GhostCog +from .guild import GuildCog +from .ping import PingCog class Events(PingCog, GuildCog, ErrorsCog, GhostCog): # PingCog needs to be first, it adds attributes diff --git a/extensions/events/_base.py b/extensions/events/_base.py new file mode 100644 index 0000000..0b99c9c --- /dev/null +++ b/extensions/events/_base.py @@ -0,0 +1,8 @@ +from discord.ext import commands + +from bot import Korii + + +class EventsBase(commands.Cog): + def __init__(self, bot: Korii): + self.bot = bot \ No newline at end of file diff --git a/extensions/events/errors.py b/extensions/events/errors.py index 0b9d4ac..9df90c2 100644 --- a/extensions/events/errors.py +++ b/extensions/events/errors.py @@ -1,6 +1,8 @@ from discord.ext import commands -from utils import Cog, BlacklistedError, Embed +from utils import BlacklistedError, Embed + +from ._base import EventsBase errors: dict[type[Exception], str] = { BlacklistedError: "bro got blacklisted 💀💀 point and laugh at this user {self.bot.E['pepepoint']}", @@ -9,7 +11,7 @@ } -class ErrorsCog(Cog): +class ErrorsCog(EventsBase): @commands.Cog.listener() async def on_command_error(self, ctx, error: Exception): if isinstance(error, commands.CommandNotFound): diff --git a/extensions/events/ghost.py b/extensions/events/ghost.py index c73feb9..e60fba4 100644 --- a/extensions/events/ghost.py +++ b/extensions/events/ghost.py @@ -1,10 +1,10 @@ import discord from discord.ext import commands -from utils import Cog +from ._base import EventsBase -class GhostCog(Cog): +class GhostCog(EventsBase): @commands.Cog.listener("on_message") async def ghost(self, message: discord.Message): if message.author.bot: @@ -14,4 +14,4 @@ async def ghost(self, message: discord.Message): return await message.reply("G-HOOOOOOST <:ghoost:1228090615510732850>", silent=True) if message.content.lower() == "👻": - return await message.reply("G-HOOOOOOST 👻", silent=True) \ No newline at end of file + return await message.reply("G-HOOOOOOST 👻", silent=True) diff --git a/extensions/events/guild.py b/extensions/events/guild.py index e487602..732a9e8 100644 --- a/extensions/events/guild.py +++ b/extensions/events/guild.py @@ -4,11 +4,12 @@ import discord from discord.ext import commands -from utils import Embed, Cog -from bot import Korii +from utils import Embed +from ._base import EventsBase -class GuildCog(Cog): + +class GuildCog(EventsBase): @commands.Cog.listener("on_guild_join") async def smash_or_pass(self, guild: discord.Guild): if not guild.owner: @@ -32,8 +33,8 @@ async def smash_or_pass(self, guild: discord.Guild): return await guild.leave() embed = Embed( - title=f"💖 Thanks for choosing Korii", - description="Thank you for choosing **Korii**. We promise to not let you down.\n" "For more information, use the `/help` command.", + title="💖 Thanks for choosing Korii", + description="Thank you for choosing **Korii**. For more information, use the `/help` command.", ) try: diff --git a/extensions/events/ping.py b/extensions/events/ping.py index fbc4bb4..a68856f 100644 --- a/extensions/events/ping.py +++ b/extensions/events/ping.py @@ -1,10 +1,12 @@ import random + import discord from discord.ext import commands -from utils import Cog +from ._base import EventsBase + -class PingCog(Cog): +class PingCog(EventsBase): @commands.Cog.listener("on_message") async def ping(self, message: discord.Message): if message.reference and message.reference.resolved: diff --git a/extensions/fun/__init__.py b/extensions/fun/__init__.py index b9d0b5c..dbc6fb5 100644 --- a/extensions/fun/__init__.py +++ b/extensions/fun/__init__.py @@ -1,5 +1,5 @@ -from .dog import DogCog from .actions import ActionsCog +from .dog import DogCog from .random import RandomCog diff --git a/extensions/fun/_base.py b/extensions/fun/_base.py new file mode 100644 index 0000000..20bad82 --- /dev/null +++ b/extensions/fun/_base.py @@ -0,0 +1,8 @@ +from discord.ext import commands + +from bot import Korii + + +class FunBase(commands.Cog): + def __init__(self, bot: Korii): + self.bot = bot \ No newline at end of file diff --git a/extensions/fun/actions.py b/extensions/fun/actions.py index ef3e969..1926018 100644 --- a/extensions/fun/actions.py +++ b/extensions/fun/actions.py @@ -3,10 +3,12 @@ import discord from discord import app_commands -from utils import Interaction, Cog +from utils import Interaction +from ._base import FunBase -class ActionsCog(Cog): + +class ActionsCog(FunBase): @app_commands.command(description="Do a funny lil' prank on someone to show how grateful you are!") @app_commands.describe(user="The user you want to prank.") @app_commands.guild_only() diff --git a/extensions/fun/dog.py b/extensions/fun/dog.py index a1b3a84..50daff8 100644 --- a/extensions/fun/dog.py +++ b/extensions/fun/dog.py @@ -1,8 +1,11 @@ from discord import app_commands -from utils import Embed, Interaction, Cog +from utils import Embed, Interaction -class DogCog(Cog): +from ._base import FunBase + + +class DogCog(FunBase): @app_commands.command(description="Sends a random image of my dog :D") @app_commands.guild_only() @app_commands.describe(ephemeral="If the message should be private or not.") diff --git a/extensions/fun/random.py b/extensions/fun/random.py index d3a05d0..a3cd09a 100644 --- a/extensions/fun/random.py +++ b/extensions/fun/random.py @@ -1,16 +1,16 @@ - import asyncio import random from typing import Optional import discord from discord import app_commands -from discord.ext import commands -from utils import Embed, Interaction, Cog +from utils import Embed, Interaction + +from ._base import FunBase -class RandomCog(Cog): +class RandomCog(FunBase): fun = app_commands.Group(name="fun", description="General entertainment commands.") async def wait_and_send(self, interaction: Interaction, content: str, wait: int = 2): diff --git a/extensions/ipc/__init__.py b/extensions/ipc/__init__.py index 0c134fb..461ccda 100644 --- a/extensions/ipc/__init__.py +++ b/extensions/ipc/__init__.py @@ -1,8 +1,9 @@ +from aiohttp import web +from aiohttp.web import Request, Response, json_response from aiohttp.web_routedef import route + from bot import Korii from utils import Cog -from aiohttp import web -from aiohttp.web import Response, json_response, Request class IPC(Cog): diff --git a/extensions/levelling/_base.py b/extensions/levelling/_base.py new file mode 100644 index 0000000..29b55d6 --- /dev/null +++ b/extensions/levelling/_base.py @@ -0,0 +1,8 @@ +from discord.ext import commands + +from bot import Korii + + +class LevellingBase(commands.Cog): + def __init__(self, bot: Korii): + self.bot = bot \ No newline at end of file diff --git a/extensions/levelling/commands.py b/extensions/levelling/commands.py index 72580b8..94c9ee8 100644 --- a/extensions/levelling/commands.py +++ b/extensions/levelling/commands.py @@ -3,12 +3,13 @@ import discord from discord import app_commands -from discord.ext import commands -from utils import Embed, Interaction, Cog +from utils import Embed, Interaction +from ._base import LevellingBase -class CommandsCog(Cog): + +class CommandsCog(LevellingBase): @app_commands.command(description="View the level of the specified member.") @app_commands.describe(user="The user you want to view the level of.") @app_commands.guild_only() diff --git a/extensions/levelling/events.py b/extensions/levelling/events.py index af5c14a..272b4f8 100644 --- a/extensions/levelling/events.py +++ b/extensions/levelling/events.py @@ -4,10 +4,12 @@ import discord from discord.ext import commands -from utils import Embed, Cog +from utils import Cog, Embed +from ._base import LevellingBase -class EventsCog(Cog): + +class EventsCog(LevellingBase): @commands.Cog.listener("on_message") async def levelling(self, message: discord.Message): if not message.guild or message.author.bot or isinstance(message.author, discord.User): diff --git a/extensions/moderation/_base.py b/extensions/moderation/_base.py new file mode 100644 index 0000000..1fe986c --- /dev/null +++ b/extensions/moderation/_base.py @@ -0,0 +1,8 @@ +from discord.ext import commands + +from bot import Korii + + +class ModerationBase(commands.Cog): + def __init__(self, bot: Korii): + self.bot = bot \ No newline at end of file diff --git a/extensions/moderation/basic.py b/extensions/moderation/basic.py index dd7b9cc..0d50f12 100644 --- a/extensions/moderation/basic.py +++ b/extensions/moderation/basic.py @@ -4,12 +4,13 @@ import discord from discord import app_commands from discord.app_commands import Choice -from discord.ext import commands -from utils import Embed, Interaction, utils, Cog +from utils import Embed, Interaction, utils +from ._base import ModerationBase -class BasicCog(Cog): + +class BasicCog(ModerationBase): @app_commands.command(description="Kicks the specified member from the server.") @app_commands.guild_only() @app_commands.default_permissions(kick_members=True) diff --git a/extensions/utility/__init__.py b/extensions/utility/__init__.py index 0482046..c567a36 100644 --- a/extensions/utility/__init__.py +++ b/extensions/utility/__init__.py @@ -1,11 +1,11 @@ from .config import ConfigCog +from .embed import EmbedCog from .info import InfoCog from .neofetch import NeofetchCog from .ping import PingCog from .source import SourceCog -from .embed import EmbedCog -from .translate import TranslateCog from .spotify import SpotifyCog +from .translate import TranslateCog class Utility(ConfigCog, InfoCog, NeofetchCog, PingCog, SourceCog, EmbedCog, TranslateCog, SpotifyCog): diff --git a/extensions/utility/_base.py b/extensions/utility/_base.py new file mode 100644 index 0000000..a019dde --- /dev/null +++ b/extensions/utility/_base.py @@ -0,0 +1,8 @@ +from discord.ext import commands + +from bot import Korii + + +class UtilityBase(commands.Cog): + def __init__(self, bot: Korii): + self.bot = bot \ No newline at end of file diff --git a/extensions/utility/config.py b/extensions/utility/config.py index 5d95ddc..55fd743 100644 --- a/extensions/utility/config.py +++ b/extensions/utility/config.py @@ -4,7 +4,9 @@ import discord from discord import app_commands -from utils import Embed, Interaction, Cog, Invalid +from utils import Embed, Interaction, Invalid + +from ._base import UtilityBase class Modal(discord.ui.Modal): @@ -177,7 +179,7 @@ async def update_message(interaction: Interaction, edit: Optional[bool] = True): return await interaction.response.send_message(f"An error occurred: {traceback.format_exception(e)}", ephemeral=True) -class ConfigCog(Cog): +class ConfigCog(UtilityBase): group = app_commands.Group(name="config", description="Configure your guild's bot configuration.") @group.command(description="Configure your guild's levelling system.") diff --git a/extensions/utility/embed.py b/extensions/utility/embed.py index 6dd1427..bda8cc9 100644 --- a/extensions/utility/embed.py +++ b/extensions/utility/embed.py @@ -1,12 +1,12 @@ -import discord from discord import app_commands -from discord.ext import commands -from utils import Interaction, Cog +from utils import Interaction from views.embed import EmbedView +from ._base import UtilityBase -class EmbedCog(Cog): + +class EmbedCog(UtilityBase): @app_commands.command(description="Create a custom embed.") @app_commands.describe(ephemeral="If the message should be sent ephemerally or not.") async def embed(self, interaction: Interaction, ephemeral: bool = False): diff --git a/extensions/utility/info.py b/extensions/utility/info.py index 42abf6a..676295b 100644 --- a/extensions/utility/info.py +++ b/extensions/utility/info.py @@ -8,7 +8,9 @@ from discord import app_commands from discord.ext import commands -from utils import utils, Embed, Interaction, Cog, EMOJIS +from utils import EMOJIS, Embed, Interaction, utils + +from ._base import UtilityBase class UserInfoView(discord.ui.View): @@ -70,7 +72,7 @@ async def delete(self, interaction: Interaction, _): return await interaction.response.send_message("hehe oki", ephemeral=True) -class InfoCog(Cog): +class InfoCog(UtilityBase): async def format_permissions(self, permissions: discord.Permissions): staff_permissions = dict({x for x in permissions if x[1] is True} - set(discord.Permissions(521942715969))) diff --git a/extensions/utility/neofetch.py b/extensions/utility/neofetch.py index 9ea98a5..ac9c0d5 100644 --- a/extensions/utility/neofetch.py +++ b/extensions/utility/neofetch.py @@ -3,10 +3,12 @@ from discord import app_commands from discord.ext import commands -from utils import Interaction, Cog +from utils import Interaction +from ._base import UtilityBase -class NeofetchCog(Cog): + +class NeofetchCog(UtilityBase): @app_commands.command(description="Neofetch but in Discord.") @app_commands.checks.cooldown(1, 5) async def neofetch(self, interaction: Interaction): diff --git a/extensions/utility/ping.py b/extensions/utility/ping.py index fbc7f20..687e720 100644 --- a/extensions/utility/ping.py +++ b/extensions/utility/ping.py @@ -1,11 +1,12 @@ from discord import app_commands from discord.ext import commands -from bot import Korii -from utils import Interaction, utils, Cog +from utils import Interaction, utils +from ._base import UtilityBase -class PingCog(Cog): + +class PingCog(UtilityBase): def spaces(self, ping: float) -> str: return " " * (9 - len(str(round(ping, 2)))) diff --git a/extensions/utility/source.py b/extensions/utility/source.py index f7654e9..6f4a685 100644 --- a/extensions/utility/source.py +++ b/extensions/utility/source.py @@ -3,12 +3,13 @@ from typing import Optional from discord import app_commands -from discord.ext import commands -from utils import Embed, Interaction, Cog +from utils import Embed, Interaction +from ._base import UtilityBase -class SourceCog(Cog): + +class SourceCog(UtilityBase): @app_commands.command(description="Get the source code of a command or the bot.") @app_commands.checks.cooldown(1, 5) async def source(self, interaction: Interaction, command: Optional[str] = None): diff --git a/extensions/utility/spotify.py b/extensions/utility/spotify.py index 3e3fb16..fdccecd 100644 --- a/extensions/utility/spotify.py +++ b/extensions/utility/spotify.py @@ -1,12 +1,14 @@ +from io import BytesIO + import discord from discord.ext import commands -from utils import Cog import config -from io import BytesIO + +from ._base import UtilityBase -class SpotifyCog(Cog): +class SpotifyCog(UtilityBase): @commands.hybrid_command() async def spotify(self, ctx: commands.Context, member: discord.Member = commands.Author): await ctx.typing() diff --git a/extensions/utility/translate.py b/extensions/utility/translate.py index 23aa42e..955e95a 100644 --- a/extensions/utility/translate.py +++ b/extensions/utility/translate.py @@ -2,10 +2,12 @@ from discord import app_commands from bot import Korii -from utils import Interaction, Cog +from utils import Interaction +from ._base import UtilityBase -class TranslateCog(Cog): + +class TranslateCog(UtilityBase): def __init__(self, bot: Korii): self.bot = bot self.ctx_menu = app_commands.ContextMenu( diff --git a/extensions/world/__init__.py b/extensions/world/__init__.py deleted file mode 100644 index 4523fbd..0000000 --- a/extensions/world/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ - -from .faq import FAQCog, FAQView -from .introductions import IntroductionsCog, IntroductionsView -from .welcome import WelcomeCog, WelcomeView - - -class World(FAQCog, IntroductionsCog, WelcomeCog): - def __init__(self, bot): - self.bot = bot - self.bot.add_view(FAQView()) - self.bot.add_view(IntroductionsView()) - self.bot.add_view(WelcomeView()) - pass - - -async def setup(bot): - await bot.add_cog(World(bot)) diff --git a/extensions/world/faq.py b/extensions/world/faq.py deleted file mode 100644 index 58841e8..0000000 --- a/extensions/world/faq.py +++ /dev/null @@ -1,126 +0,0 @@ -import discord -from discord.ext import commands -from discord.ext.commands import command - -from bot import Korii -from utils import Embed, Interaction - - -class TicketModal(discord.ui.Modal, title="🎫 Create Ticket"): - def __init__(self): - super().__init__(timeout=360) - - code = discord.ui.TextInput( - label="Code", - placeholder="The code here...", - min_length=4, - max_length=4, - required=True, - style=discord.TextStyle.paragraph, - ) - - async def on_submit(self, interaction: Interaction): - return - - async def on_error(self, interaction: Interaction, error: Exception) -> None: - return - - -class FAQView(discord.ui.View): - def __init__(self): - super().__init__(timeout=None) - - @discord.ui.button(emoji="⚡", label="Levelling Rewards", style=discord.ButtonStyle.blurple, custom_id="world:levelling_rewards") - async def levelling_rewards(self, interaction: Interaction, _): - rewards = [ - "<@&1069284713056977006> Custom color roles", - "<@&1069284714311057478> Host your own events", - "<@&1069284715498053632> More color roles, higher chance of Simon", - "<@&1069284717821710368> Create private threads, color roles", - "<@&1069284719197442129> Start activities, use stickers", - "<@&1069284720086634637> Send links, stream, create public threads", - "<@&1069284769000587336> Change your nickname, add reactions", - ] - - embed = Embed( - title="⚡ Levelling Rewards", - description="\n".join([f"**` - `** {reward}" for reward in rewards]), - ) - - return await interaction.response.send_message(embed=embed, ephemeral=True) - - @discord.ui.button(emoji="🎫", label="Create Ticket", style=discord.ButtonStyle.green, custom_id="world:ticket") - async def create_ticket(self, interaction: Interaction, _): - return await interaction.response.send_message( - "This feature is coming soon, for the time being, you can contact the server owner.", - ephemeral=True, - ) - - # return await interaction.response.send_modal(TicketModal()) - - -class FAQCog(commands.Cog): - def __init__(self, bot: Korii): - self.bot = bot - - @command() - @commands.is_owner() - async def faq(self, ctx: commands.Context): - if not ctx.message.reference: - return await ctx.send("No reply.") - - message = ctx.message.reference.resolved - - if not isinstance(message, discord.Message): - return await ctx.send("Invalid reply.") - - embed = Embed( - title="❓ Frequently Asked Questions", - description="Here are some frequently asked questions.", - color=0x10B981, - ) - - embed.add_field( - name="1️⃣ Where are the rules?", - value="You can find the rules at <#1069276775055638548> by clicking the **📜 Rules** button.", - inline=False, - ) - - embed.add_field( - name="2️⃣ How do I get reaction roles?", - value="You can get reaction roles at .", - inline=False, - ) - - embed.add_field( - name="3️⃣ Where can I invite Korii?", - value="[Click here](https://bot.korino.dev) to invite it.", - inline=False, - ) - - embed.add_field( - name="4️⃣ How do I join the Korino PvP Minecraft Server?", - value="[Click here](https://korino.dev/pvp) to visit the Korino PvP website.", - inline=False, - title=False, - ) - - embed.add_field( - name="5️⃣ Are there any levelling rewards?", - value="Yes, for more info click the **⚡ Levelling Rewards** button below.", - inline=False, - ) - - embed.add_field( - name="6️⃣ Why are some buttons blue and some green?", - value="Blue buttons not interactive and send text/info. Green buttons are interactive buttons which you can interact with after pressing.", - inline=False, - ) - - embed.add_field( - name="7️⃣ My question was not answered here/I need help.", - value="Create a ticket by clicking the **🎫 Create Ticket** button below.", - inline=False, - ) - - return await message.edit(content=None, embed=embed, view=FAQView()) diff --git a/extensions/world/introductions.py b/extensions/world/introductions.py deleted file mode 100644 index 3d52c6d..0000000 --- a/extensions/world/introductions.py +++ /dev/null @@ -1,58 +0,0 @@ -import discord -from discord.ext import commands - -from bot import Korii -from utils import Embed, Interaction - - -class IntroductionsView(discord.ui.View): - def __init__(self): - super().__init__(timeout=None) - - @discord.ui.button( - label="Template", - emoji="📋", - custom_id="world:view_example", - style=discord.ButtonStyle.blurple, - ) - async def template(self, interaction: Interaction, button: discord.ui.Button): - template = [ - "👋 Hello my name is **[name]**", - "⏰ I am **[age]** years old.", - "🌎 I am from **[country]**.", - "🎮 My hobbies are **[hobbies]**.", - ] - - embed = Embed( - title="🎭 Template", - description="\n".join(template), - ) - - embed.set_footer(text="You can modify this template as much as you like. You also don't have to use it, and you can just make your own.") - - return await interaction.response.send_message(embed=embed, ephemeral=True) - - -class IntroductionsCog(commands.Cog): - def __init__(self, bot: Korii): - self.bot = bot - - @commands.command() - @commands.is_owner() - async def introductions(self, ctx: commands.Context): - if not ctx.message.reference: - return await ctx.send("No reply.") - - message = ctx.message.reference.resolved - - if not isinstance(message, discord.Message): - return await ctx.send("Invalid reply.") - - embed = Embed( - title="🎭 Introductions", - description="Here you can introduce yourself to the rest of the server.\n" - "Click the button below for a template you can use, you can also make your own if you wanna get creative.", - color=0x10B981, - ) - - return await message.edit(content=None, embed=embed, view=IntroductionsView()) diff --git a/extensions/world/join.py b/extensions/world/join.py deleted file mode 100644 index c15de70..0000000 --- a/extensions/world/join.py +++ /dev/null @@ -1,20 +0,0 @@ -import discord -from discord.ext import commands - -from utils import Korii - - -class JoinCog(commands.Cog): - def __init__(self, bot: Korii): - self.bot = bot - - @commands.Cog.listener("on_member_join") - async def ping_new_member(self, member: discord.Member): - if member.guild.id != 1059116571215278121: - return - - channel = self.bot.get_channel(1069276775055638548) - - assert isinstance(channel, discord.TextChannel) - - return await channel.send(member.mention, allowed_mentions=discord.AllowedMentions.all()) diff --git a/extensions/world/welcome.py b/extensions/world/welcome.py deleted file mode 100644 index 7131a63..0000000 --- a/extensions/world/welcome.py +++ /dev/null @@ -1,57 +0,0 @@ -import discord -from discord.ext import commands - -from utils import Embed, Interaction - - -class WelcomeView(discord.ui.View): - def __init__(self): - super().__init__(timeout=None) - - @discord.ui.button(emoji="📜", label="Rules", style=discord.ButtonStyle.blurple, custom_id="world:rules") - async def rules(self, interaction: Interaction, button: discord.ui.Button): - embed = Embed( - title="📜 Rules of Korino World", - description="**` 01. `** Be respectful and kind to all members of the server.\n" - "**` 02. `** No hate speech or discriminatory language of any kind.\n" - "**` 03. `** Do not spam or flood the chat with messages.\n" - "**` 04. `** No NSFW or explicit content is allowed.\n" - "**` 05. `** Do not share personal information without consent.\n" - "**` 06. `** No bullying, harassment, or threatening behavior.\n" - "**` 07. `** Follow the instructions of moderators and administrators.\n" - "**` 08. `** Do not post links to phishing or malicious websites.\n" - "**` 09. `** Keep conversations appropriate for the designed channels.\n" - "**` 10. `** No sharing of pirated or copyrighted content.\n" - "**` 11. `** Do not impersonate other members or use fake accounts.\n" - "**` 12. `** Any behavior that violates [**Discord's terms of service**](https://discord.com/terms) or [**Discord's community guideline**](https://discord.com/guidelines) will not be tolerated.", - color=0x10B981, - ) - - return await interaction.response.send_message(embed=embed, ephemeral=True) - -class WelcomeCog(commands.Cog): - def __init__(self, bot): - self.bot = bot - - @commands.command() - @commands.is_owner() - async def welcome(self, ctx: commands.Context): - if not ctx.message.reference: - return await ctx.send("No reply.") - - message = ctx.message.reference.resolved - - if not isinstance(message, discord.Message): - return await ctx.send("Invalid reply.") - - embed = Embed( - title="👋 Welcome to Korino World!", - description="Korino World is a chill and welcoming community server." - "We offer a lot of stuff including giveaways, events, a Minecraft Server and more!\n\n" - "Here are the top things to do:\n" - "**` - `** 📖 Read the rules by clicking **📜 Rules**.\n" - "**` - `** 🛠️ Learn more about our projects and us by visiting [**our website**](https://spooki.xyz).\n" - "**` - `** 💬 Chat with other people and make friends in <#1082039515067191397>.", - ) - - return await message.edit(content=None, embed=embed, view=WelcomeView()) diff --git a/main.py b/main.py index 6913822..da54c93 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,10 @@ -import discord import asyncio -from bot import Korii + +import discord from discord import app_commands +from bot import Korii + bot: Korii = Korii() async def on_error(interaction: discord.Interaction[Korii], error: app_commands.AppCommandError): diff --git a/utils/__init__.py b/utils/__init__.py index aed2041..0d2ac5d 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -3,8 +3,8 @@ from bot import Korii from .bases import * -from .utils import * from .constants import * +from .utils import * Interaction: TypeAlias = discord.Interaction[Korii] diff --git a/utils/bases/cog.py b/utils/bases/cog.py index 960b6bc..74eb7ca 100644 --- a/utils/bases/cog.py +++ b/utils/bases/cog.py @@ -1,6 +1,7 @@ from typing import Any, Optional from discord.ext import commands + from bot import Korii diff --git a/utils/bases/tree.py b/utils/bases/tree.py index 087c648..95e8e9a 100644 --- a/utils/bases/tree.py +++ b/utils/bases/tree.py @@ -1,5 +1,6 @@ from __future__ import annotations -from typing import Dict, Optional, List, TYPE_CHECKING, Union + +from typing import TYPE_CHECKING, Dict, List, Optional, Union import discord from discord import app_commands