forked from Tricked-dev/discord-akairo
-
Notifications
You must be signed in to change notification settings - Fork 5
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:
-
allis run on all messages. -
preis run on messages not blocked byalland built-in inhibitors. -
post(the default) is run on messages before commands, not blocked by the previous.
The built-in inhibitors are:
-
clientblocks the client (itself). -
botblocks all other bots. -
ownerblocks non-owners from using owner-only commands. -
guildblocks guild-only commands used in DMs. -
dmblocks DM-only commands used in guilds.
To make it easier to visualize, here is the order:
-
alltype inhibitors. -
client, andbot. - (commands sent when someone is in the middle of being prompted are blocked here)
-
pretype inhibitors. -
owner,guild, anddm. - (commands that have missing permissions are blocked here)
-
posttype inhibitors. - (commands under cooldown are blocked here)