Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another blind spot of command sync algorithm #1108

Open
3 tasks done
EQUENOS opened this issue Sep 18, 2023 · 0 comments · May be fixed by #1129
Open
3 tasks done

Another blind spot of command sync algorithm #1108

EQUENOS opened this issue Sep 18, 2023 · 0 comments · May be fixed by #1129
Labels
bug Something isn't working

Comments

@EQUENOS
Copy link
Member

EQUENOS commented Sep 18, 2023

Summary

Unloading app commands with guild_ids which were not specified anywhere else doesn't delete those commands.

Reproduction Steps

  • Register an app command X with exclusive guild_ids (by exclusive I mean that those guild_ids are not associated with other commands; by registering I mean adding a command and applying the sync algo)
  • Remove the app command X and resync

Minimal Reproducible Code

import disnake
from disnake.ext import commands


class Misc(commands.Cog):
    @commands.slash_command(guild_ids=[859404768992165920])
    async def example(self, inter: disnake.AppCmdInter) -> None:
        ...


bot = commands.InteractionBot(command_sync_flags=commands.CommandSyncFlags.all())
bot.add_cog(Misc())


@bot.event
async def on_ready():
    bot.remove_cog("Misc")
    print("Bot is ready. You can check the list of commands")


bot.run("BOT_TOKEN")

Expected Results

Command X should be gone

Actual Results

The command stays in the list of commands

Intents

disnake.Intents.default()

System Information

- Python v3.8.6-final
- disnake v2.9.0
    - disnake importlib.metadata: v2.4.0  
- aiohttp v3.8.1
- system info: Windows 10 10.0.19041 AMD64

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

Probably the best solution is to compare ConnectionState._guild_application_commands to the list of invokable slash commands and remove any commands that are included in the first dict but are missing in the second.

@EQUENOS EQUENOS added unconfirmed bug Something might not be working bug Something isn't working and removed unconfirmed bug Something might not be working labels Sep 18, 2023
@koshakkkq koshakkkq linked a pull request Oct 29, 2023 that will close this issue
8 tasks
@shiftinv shiftinv linked a pull request Nov 3, 2023 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant