diff --git a/bot/cogs/commands/general.py b/bot/cogs/commands/general.py index 5daf0ad..dbde9ba 100644 --- a/bot/cogs/commands/general.py +++ b/bot/cogs/commands/general.py @@ -86,7 +86,7 @@ class AvatarView(View): await interaction.response.edit_message(embed=embed) -from utils.config import BotName +from utils.config import BotName, DISCORD_CLIENT_ID class General(commands.Cog): @@ -309,7 +309,7 @@ class General(commands.Cog): invite_text = ( "```Empower your server with blazing-fast features and 24/7 support!```\n" f"{AXIOM_LINKS} **Quick Actions**\n" - f">>> **[Invite {BotName}](https://discord.com/oauth2/authorize?client_id=1396114795102470196&permissions=8&integration_type=0&scope=bot+applications.commands)**\n" + f">>> **[Invite {BotName}](https://discord.com/oauth2/authorize?client_id={DISCORD_CLIENT_ID or (ctx.bot.user.id if ctx.bot.user else '')}&permissions=8&integration_type=0&scope=bot%20applications.commands)**\n" "**[Support Server](https://discord.gg/hexahost)**" ) await ctx.send(view=CV2(f"{AXIOM_CONNECTION} {BotName} Integration Hub!", invite_text)) \ No newline at end of file diff --git a/bot/cogs/events/mention.py b/bot/cogs/events/mention.py index 3ec0858..00f3c06 100644 --- a/bot/cogs/events/mention.py +++ b/bot/cogs/events/mention.py @@ -13,7 +13,7 @@ from utils.db_paths import db_path from utils import getConfig -from utils.config import BotName +from utils.config import BotName, DISCORD_CLIENT_ID import discord from utils.emoji import ARROWRED, CODEBASE, HEART3, INDEX, AXIOM_LINKS from discord.ui import LayoutView, TextDisplay, Separator, Container, ActionRow, Select @@ -87,7 +87,7 @@ class MentionSelectView(LayoutView): ) elif selected == "Links": content = ( - f"**[Invite {BotName}](https://discord.com/oauth2/authorize?client_id=1396114795102470196)**\n" + f"**[Invite {BotName}](https://discord.com/oauth2/authorize?client_id={DISCORD_CLIENT_ID or (self.bot.user.id if self.bot.user else '')}&permissions=8&scope=bot%20applications.commands)**\n" "**[Join Support Server](https://discord.gg/hexahost)**" ) diff --git a/bot/utils/slash_sync.py b/bot/utils/slash_sync.py index 3b169f1..fa9fc5c 100644 --- a/bot/utils/slash_sync.py +++ b/bot/utils/slash_sync.py @@ -119,31 +119,29 @@ async def sync_slash_commands( "pruned": removed, } - async def _try_sync(label: str, coro): + async def _try_sync(label: str, factory): try: - synced = await coro + synced = await factory() return synced, None except Exception as e: - # Drop invalid commands once and retry (common after bulk hybrid conversion) detail = str(e) logger.error("%s failed: %s", label, detail) dropped = [] for cmd in list(bot.tree.get_commands()): - # Heuristic: remove cmds whose name appears in the error payload if cmd.name in detail or getattr(cmd, "qualified_name", "") in detail: bot.tree.remove_command(cmd.name) dropped.append(cmd.name) if dropped: print(f"\033[33m◈ Removed invalid slash cmd(s) after error: {', '.join(dropped)}\033[0m") try: - synced = await coro + synced = await factory() return synced, None except Exception as e2: return None, f"{label}: {e2}" return None, f"{label}: {e}" if do_global: - synced, err = await _try_sync("Global slash sync", bot.tree.sync()) + synced, err = await _try_sync("Global slash sync", lambda: bot.tree.sync()) if err: result["errors"].append(err) print(f"\033[31m◈ {err}\033[0m") @@ -162,11 +160,13 @@ async def sync_slash_commands( for guild in target_guilds: gid = getattr(guild, "id", guild) - async def _guild_sync(g=guild): - bot.tree.copy_global_to(guild=g) - return await bot.tree.sync(guild=g) + def _make_factory(g=guild): + async def _factory(): + bot.tree.copy_global_to(guild=g) + return await bot.tree.sync(guild=g) + return _factory - synced, err = await _try_sync(f"Guild {gid} slash sync", _guild_sync()) + synced, err = await _try_sync(f"Guild {gid} slash sync", _make_factory()) if err: result["errors"].append(err) print(f"\033[31m◈ {err}\033[0m")