forked from Tricked-dev/discord-akairo
-
Notifications
You must be signed in to change notification settings - Fork 6
inhibtypes
IRONM00N edited this page Oct 11, 2021
·
1 revision
Right now, your inhibitors only runs before a command.
They do not actually run on all messages.
To change that, change the type
option.
import { Inhibitor } from "discord-akairo";
import { Message } from "discord.js";
export default class BlacklistInhibitor extends Inhibitor {
constructor() {
super("blacklist", {
reason: "blacklist",
type: "all"
});
}
exec(message: Message): boolean {
// Still a meanie!
const blacklist = ["81440962496172032"];
return blacklist.includes(message.author.id);
}
}
There are three types:
-
all
is run on all messages. -
pre
is run on messages not blocked byall
and built-in inhibitors. -
post
(the default) is run on messages before commands, not blocked by the previous.
The built-in inhibitors are:
-
client
blocks the client (itself). -
bot
blocks all other bots. -
owner
blocks non-owners from using owner-only commands. -
guild
blocks guild-only commands used in DMs. -
dm
blocks DM-only commands used in guilds.
To make it easier to visualize, here is the order:
-
all
type inhibitors. -
client
, andbot
. - (commands sent when someone is in the middle of being prompted are blocked here)
-
pre
type inhibitors. -
owner
,guild
, anddm
. - (commands that have missing permissions are blocked here)
-
post
type inhibitors. - (commands under cooldown are blocked here)