GuildCheck class
A check that checks that a command was executed in a particular guild, or in a channel that is not in a guild.
This check is special as commands with this check will only be registered as slash commands in the guilds specified by this guild check. For this functionality to work, however, this check must be a "top-level" check - that is, a check that is not nested within a modifier such as Check.any, Check.deny or Check.all.
The value of this check overrides CommandsPlugin.guild.
This check integrates with the Discord Slash Command Permissions API, so users that cannot use a command because of this check will have that command appear unavailable out in their Discord client.
You might also be interested in:
- CommandsPlugin.guild, for globally setting a guild to register slash commands to.
- Inheritance
-
- Object
- AbstractCheck
- Check
- GuildCheck
Constructors
- GuildCheck(Guild guild, {String? name})
-
Create a GuildCheck that succeeds if the context originated in
guild
. - GuildCheck.all({String? name})
- Create a GuildCheck that succeeds if the context originated in a guild.
-
GuildCheck.any(Iterable<
Guild> guilds, {String? name}) -
Create a GuildCheck that succeeds if the context originated in any of
guilds
. -
GuildCheck.anyId(Iterable<
Snowflake> ids, {String? name}) -
Create a GuildCheck that succeeds if the id of the guild the context originated in is in
ids
. - GuildCheck.id(Snowflake id, {String? name})
-
Create a GuildCheck that succeeds if the ID of the guild the context originated in is
id
. - GuildCheck.none({String? name})
- Create a GuildCheck that succeeds if the context originated outside of a guild (generally, in private messages).
Properties
-
allowsDm
→ FutureOr<
bool> -
Whether this check will allow commands to be executed in DM channels.
finalinherited
-
guildIds
↔ Iterable<
Snowflake?> -
The IDs of the guilds that this check allows.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The name of this check.
finalinherited
-
postCallHooks
→ Iterable<
void Function(CommandContext context)> -
An iterable of callbacks executed after a command is executed.
no setterinherited
-
preCallHooks
→ Iterable<
void Function(CommandContext context)> -
An iterable of callbacks executed before a command is executed but after all the checks for
that command have succeeded.
no setterinherited
-
requiredPermissions
→ FutureOr<
Flags< Permissions> ?> -
The permissions required from members to pass this check.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
check(
CommandContext context) → FutureOr< bool> -
Validate
context
against this check.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited