Incendo / cloud-discord

Discord integrations for Cloud v2.
https://cloud.incendo.org/discord/
MIT License
5 stars 1 forks source link

[2.0.0] @CommandDescription ignored #58

Open Stijn-van-Nieulande opened 3 months ago

Stijn-van-Nieulande commented 3 months ago

Hello, I got a issue with the @CommandDescription annotations in the new cloud 2 environment with JDA5. When using the command description annotation the value of it is "ignored" and the last parameter of the command is used as the description.

Discord_qie3rYoCSt

It seems that the description is used of the last non flag argument which doesn't have a description attached to it.

idea64_zOMOVvOpmZ idea64_o66uh1lfoJ idea64_e5YnK1wfeI
Citymonstret commented 3 months ago

This is semi-intentional. A cloud command is a unique chain of arguments whereas Discord considers the root literal to be the command, and everything else to be an argument. Because a root literal may be used for multiple cloud commands, it would be far less accurate to use the cloud command description as the Discord command description. The component descriptions are re-used across commands so they are a better fit.

The issue here is that the wrong component description is used. It should use the root description, not the tail description.

masmc05 commented 3 months ago

This is semi-intentional. A cloud command is a unique chain of arguments whereas Discord considers the root literal to be the command, and everything else to be an argument. Because a root literal may be used for multiple cloud commands, it would be far less accurate to use the cloud command description as the Discord command description. The component descriptions are re-used across commands so they are a better fit.

The issue here is that the wrong component description is used. It should use the root description, not the tail description.

That's not really true, you need to specify the description per sub command in constructor (https://javadoc.io/doc/net.dv8tion/JDA/latest/net/dv8tion/jda/api/interactions/commands/build/SubcommandData.html#%3Cinit%3E(java.lang.String,java.lang.String), when using subcommands, the description of the root command is only displayed in guid settings in "interactions" section, and is not really displayed to the user

Citymonstret commented 3 months ago

This is semi-intentional. A cloud command is a unique chain of arguments whereas Discord considers the root literal to be the command, and everything else to be an argument. Because a root literal may be used for multiple cloud commands, it would be far less accurate to use the cloud command description as the Discord command description. The component descriptions are re-used across commands so they are a better fit. The issue here is that the wrong component description is used. It should use the root description, not the tail description.

That's not really true, you need to specify the description per sub command in constructor (https://javadoc.io/doc/net.dv8tion/JDA/latest/net/dv8tion/jda/api/interactions/commands/build/SubcommandData.html#%3Cinit%3E(java.lang.String,java.lang.String), when using subcommands, the description of the root command is only displayed in guid settings in "interactions" section, and is not really displayed to the user

Interesting. I wasn't aware of this, but it'd then be fine to prioritize the command description if it exists. I'd appreciate a PR to deal with this if anyone wants to see it dealt with.