import random from discord import ApplicationContext, DiscordException, Game, Guild from discord.ext.commands import Cog from Christmas.UI.Embed import Default_Embed class Event(Cog): def __init__(self, bot): self.bot = bot @Cog.listener() async def on_application_command_error(self, ctx: ApplicationContext, exception: DiscordException) -> None: print(exception) @Cog.listener() async def on_ready(self) -> None: print("Ready!") await self.bot.change_presence(activity=Game(name="크리스마스에 함께!")) @Cog.listener() async def on_guild_join(self, guild: Guild) -> None: if guild.system_channel is not None: await guild.system_channel.send(embed=Default_Embed.guild_join()) else: await random.choice(guild.text_channels).send(embed=Default_Embed.guild_join()) def setup(bot): bot.add_cog(Event(bot))