diff --git a/bot.py b/bot.py index 23a6a86..061daec 100644 --- a/bot.py +++ b/bot.py @@ -31,16 +31,24 @@ class ChristmasBot(commands.Bot): self.config = config self.colors: Dict[str, Color] = self.process_colours(config.get("colors", [])) + self.invite_link: str = "" + super().__init__( command_prefix=self.prefix_callable, - description=self.config["info"].get("description"), + description=self.config["info"].get("description", ""), case_insensitive=False, fetch_offline_members=False, intents=intents, + slash_commands=True, slash_command_guilds=[227431704426446848], ) - async def prefix_callable(self, _, msg: Message): + self.loop.create_task(self.async_init()) + + async def async_init(self): + await self.load_cogs(self.initial_cog_names) + + async def prefix_callable(self, _, msg: Message) -> List[str]: return commands.when_mentioned_or(*self.config["prefixes"])(self, msg) async def load_cogs(self, cog_names: Sequence[str]): @@ -52,14 +60,11 @@ class ChristmasBot(commands.Bot): print(f"Failed to load extension {cog}.\n\t{e}", file=sys.stderr) async def on_ready(self): + self.invite_link = f"https://discord.com/oauth2/authorize?client_id={self.user.id}&permissions=3230720&scope=bot%20applications.commands" + print(f"Logged in as: {self.user}") print(f"Version: {discord.__version__}") - print( - f"Invite: https://discord.com/oauth2/authorize?scope=bot&client_id=257816631072391168&permissions=70642768" - ) - text = "ck!connect | ck!help" - await self.change_presence(activity=discord.Game(text)) - await self.load_cogs(self.INITIAL_EXTENSIONS) + print(f"Invite: {self.invite_link}") def process_colours(self, colors: Dict[str, str]) -> Dict[str, Color]: colour_dict: Dict[str, Color] = {}