-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat: Allow empty iterables as a command_prefix #7809
Conversation
This feels a bit overeager as a solution to this problem. Use There are obviously caveats to each of these proposed solutions but they will fit needs generally. |
Cogs, among other things, still require
Many people will still want to listen for messages even if they don't have a command prefix.
This is true, but I feel it is much less intuitive than the alternative I am suggesting. The most obvious way one may think to disable the prefix is by setting it to None or an empty list. Also, this change also allows you to conditionally have no prefix, for example, in some servers you may want a prefix, but in others, you can have your prefix function return None. |
As I said each solution fits other needs better. Your solution here disabling the prefix does not stop each message being processed, so the work is still being "done" to try and parse each message that comes in. If you wish to fully disable message processing then it should be done in an alternate way. Editing for clarity: |
I agree that for performance, I will make this performance enhancement. |
I'd like to hear what @Rapptz thinks given the points I have made. To be clear, the main goal of this change is for:
|
Hi. I've rejected this before in the discord.py server. In my mind, the command extension will always be designed for regular commands first and foremost. I have no plan to specialise it for app command only usage. There are ways to get around this if you know what to do, for example overriding Even in the post-message content intent world, commands with a mention prefix will work just fine. |
Is there any reason not to make doing that easier for the user? This doesn't have any negative side-effects to users who do want to use commands. Also, if the commands module is specifically for regular commands, are there any plans to separate extensions, cogs, and listeners from the module, so people can make use of them without bringing in everything else from the commands extension? |
I think, at best, allowing you to pass
Nope. |
So you would be fine with the PR if it just allowed empty iterables, but without making the prefix optional? |
Yeah that'd be fair. |
Ok, I've updated the PR. Do you want the change to |
There is no need to modify |
I've reverted that as well now |
Thanks. |
Problem
If you don't want any prefix or even pings to trigger commands (for example if you only have slash commands or have no prefixed commands), you currently need a hackish workaround such as:
Solution
This change allows passing an empty iterable to not listen for any prefix. This way developers do not need to specify a prefix if they don't have any commands that use it (for example, if the bot only uses slash commands or listeners such as
on_message
)Checklist