filters
- filters
type: { allowUsers: (userIds: Snowflake[]) =>
CommandFilter; and: (items:CommandFilter[]) =>CommandFilter; custom: (check:CommandFilter[“check”]) =>CommandFilter; guildOnly: (message: string) =>CommandFilter; hasAllRoles: (roleIds: Snowflake[]) =>CommandFilter; hasAnyRole: (roleIds: Snowflake[]) =>CommandFilter; hasRole: (roleId: Snowflake) =>CommandFilter; not: (item:CommandFilter) =>CommandFilter; or: (items:CommandFilter[]) =>CommandFilter; silent: (item:CommandFilter) =>CommandFilter; withMessage: (item:CommandFilter, message: string) =>CommandFilter; }Ready-made command filters. Pass them in a command’s
filtersarray; they run in order and the first failure stops the command.filters: [discord.filters.or(discord.filters.hasRole(modRoleId), discord.filters.allowUsers(ownerId))],
Values
Name |
Value |
Description |
|---|---|---|
|
|
Allows only these user IDs. |
|
|
Passes when every filter passes; replies with the first failure. |
|
|
Wraps a check function as a filter. |
|
|
Rejects use outside a server, replying with |
|
|
Requires the member to have every one of these roles. |
|
|
Requires the member to have at least one of these roles. |
|
|
Requires the member to have this role. |
|
|
Inverts a filter. A failure caused by |
|
|
Passes when any filter passes; replies with the last failure. |
|
|
Stops the command without replying when the filter fails. |
|
|
Replaces a filter’s failure reply with |