nosedrum icon indicating copy to clipboard operation
nosedrum copied to clipboard

Add an example of an ApplicationCommand of type :message

Open sylvesterroos opened this issue 1 year ago • 1 comments

I would like to use :message commands instead of :slash command, but I can't find any info on how to do that. I don't want to use the TextCommand storage since that can't be limited to a single guild like you can do with Nosedrum.Storage.Dispatcher.add_command

sylvesterroos avatar Oct 31 '23 22:10 sylvesterroos

Hi, late response, sorry.

The message type isn't actually what you think it is. It is still an application command, it is just a different way of invoking said command. You can read more about it here.

Basically, the type of command you're actually thinking about is a TextCommand. Unfortunately, due to the way permissions and guilds work, there's no reasonable way to limit text commands to a single guild. Any guild that the bot joins would be able to type the command into chat, and TextCommand bots simply scrape every message and apply whatever checks you write into your bot yourself to determine whether it's a valid command or not.

Nosedrum does ship with a default TextCommand implementation called TextCommand.Invoker.Split. This default implementation does not apply any checking of guilds. If you want that functionality, you would need to implement your own Invoker to filter out any messages not from your whitelisted guilds. You should be able to use TextCommand.Invoker.Split as reference material to write your own if this is the route you want to take.

kshannoninnes avatar May 04 '24 15:05 kshannoninnes