You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following table below represents how it would be shown as a JSON object:
335
+
336
+
.. code-block:: python
337
+
338
+
{
339
+
"name": "Name of my command.",
340
+
"type": 3
341
+
}
342
+
343
+
The following table explains more about the `type` parameter being passed, which there are three of: `CHAT_INPUT`, `USER` and `MESSAGE`. By default, the type will
344
+
always be the first. This is because it is a registered type that is used to process slash commands, and should not be used for when you are declaring context menu
345
+
commands in your bot's code at all:
346
+
347
+
+------------+-----------+
348
+
| **Name** | **Value** |
349
+
+------------+-----------+
350
+
| CHAT_INPUT | 1 |
351
+
+------------+-----------+
352
+
| USER | 2 |
353
+
+------------+-----------+
354
+
| MESSAGE | 3 |
355
+
+------------+-----------+
356
+
357
+
Unlike `manage_commands` and `manage_components`, you will have to use a decorator for now to register them:
358
+
359
+
.. code-block :: python
360
+
361
+
from discord_slash.model import ContextMenuType
362
+
363
+
@slash.context_menu(ContextMenuType.MESSAGE,
364
+
name="commandname",
365
+
guild_ids=[789032594456576001])
366
+
async def commandname(ctx: MenuContext):
367
+
await ctx.send(
368
+
content="Responded!",
369
+
hidden=True
370
+
)
371
+
372
+
The `@slash.context_menu` decorator takes in the context type as given (to either appear when you right-click on a user or when you right-click on a message) as well
373
+
as the name of the command, and any guild IDs if given if you would like to make it applicable to only a guild. **We only accept connected names** for the time being,
374
+
although context menus will have the ability to have spaces in their name in the future when development further progresses.
375
+
376
+
Hey, what about component/[X] listening?
377
+
----------------------------------------
378
+
The decision has been made that this will not be implemented because of two reasons: context menus currently have no ability to hold any options or choices, so listening
379
+
for any responses would be currently pointless. Additionally, component listening is already a built-in feature that does not require further customized and new decorators
380
+
for explicitly context menus, as they're more universal.
0 commit comments