mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
Build invite link only once + fixed slash_command loading
This commit is contained in:
@@ -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] = {}
|
||||
|
||||
Reference in New Issue
Block a user