|
1 | 1 | import pathlib |
2 | 2 |
|
| 3 | +import discord |
3 | 4 | from colorama import Fore |
4 | 5 | from discord import ( |
5 | 6 | Color, |
|
8 | 9 | Interaction, |
9 | 10 | Member, |
10 | 11 | Message, |
| 12 | + Object, |
11 | 13 | Permissions, |
12 | 14 | User, |
13 | 15 | VoiceClient, |
@@ -60,10 +62,10 @@ async def setup_hook(self): |
60 | 62 | @Cog.listener() |
61 | 63 | async def on_ready(self): |
62 | 64 | log.success(f"🎮 Bot client connected as {self.user}.") |
63 | | - log.info("\n" + self.cogs_info_text) |
64 | | - log.info("\n" + self.app_commands_info_text) |
65 | | - log.info("\n" + await self.app_commands_remote_info_text) |
66 | | - log.info("\n" + self.commands_info_text) |
| 65 | + # log.info("\n" + self.cogs_info_text) |
| 66 | + # log.info("\n" + self.app_commands_info_text) |
| 67 | + # log.info("\n" + await self.app_commands_remote_info_text) |
| 68 | + # log.info("\n" + self.commands_info_text) |
67 | 69 | # await self.sync_commands() |
68 | 70 |
|
69 | 71 | # ---------------------------------------------------------------------------------------------------- |
@@ -106,11 +108,12 @@ async def load_cogs(self): |
106 | 108 | ) |
107 | 109 | log.success(f"{len(self.cogs)}/{len(cog_classes)} cogs loaded.") |
108 | 110 |
|
109 | | - async def sync_commands(self) -> tuple[int, int]: |
| 111 | + async def sync_commands(self, guild: Guild | None = None) -> tuple[int, int]: |
110 | 112 | """Sync commands and get (synced, all) commands count.""" |
111 | 113 | log.loading("Syncing commands...") |
112 | | - all_cmds = self.tree.get_commands() |
113 | | - synced_cmds = await self.tree.sync() |
| 114 | + guild_obj = Object(id=guild.id) if guild else None |
| 115 | + all_cmds = self.tree.get_commands(guild=guild_obj) |
| 116 | + synced_cmds = await self.tree.sync(guild=guild_obj) |
114 | 117 | for cmd in synced_cmds: |
115 | 118 | log.info(f"{cmd} command synced.") |
116 | 119 | count = (len(synced_cmds), len(all_cmds)) |
|
0 commit comments