Annotation Interface ContextCommand
Methods annotated with ContextMenu will be registered as a context menu command.
Therefore, the method must be declared inside a class that is annotated with
Interaction
.
Furthermore, the method signature has to meet the following conditions:
- First parameter must be of type
CommandEvent
- Second parameter must either be a
User
or aMessage
Examples:
@ContextCommand(value = "message context command", type = Command.Type.MESSAGE)
public void onCommand(CommandEvent event, Message target) { ... }
@ContextCommand(value = "user context command", type = Command.Type.USER)
public void onCommand(CommandEvent event, User target) { ... }
- See Also:
-
Required Element Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionReturns an array ofPermission
this command should be enabled for by default.boolean
Returns whether this command is only usable in a guild.boolean
Returns whether this command can only be executed in NSFW channels.Returns whether this command should be registered as a global or as a guild command.Returns the name of the command.
-
Element Details
-
value
-
isGuildOnly
boolean isGuildOnlyReturns whether this command is only usable in a guild. This only has an effect if this command is registered globally.- Returns:
true
if this command is only usable in a guild
- Default:
false
-
isNSFW
boolean isNSFWReturns whether this command can only be executed in NSFW channels.- Returns:
true
if this command can only be executed in NSFW channels
- Default:
false
-
enabledFor
Permission[] enabledForReturns an array ofPermission
this command should be enabled for by default. Note that guild admins can modify this at any time.- Returns:
- an array of permissions this command will be enabled for by default
- See Also:
- Default:
{UNKNOWN}
-
scope
CommandScope scopeReturns whether this command should be registered as a global or as a guild command.- Returns:
- whether this command should be registered as a global or as a guild command
- See Also:
- Default:
GLOBAL
-
type
-