-
Notifications
You must be signed in to change notification settings - Fork 0
Post Event Functions
Arthur Neuman edited this page Jul 26, 2020
·
2 revisions
If you'd like to have a function run after an event happens (message, reaction, prefix alter, permission change) even if a command is not executed, you can!
Just simply define the functions in your agent constructor.
function PMFunc (msg, results) {
if (results) { // If a command was executed
console.log(`${msg.timestamp} - **${msg.author.username}** > *${results.command.name}*`)
if (msg.channel.id === '1233673') msg.channel.createMessage('You shouldn't be using commands in this channel...')
}
}
const agent = new Agent({
Eris,
token: TOKEN,
options: {
postEventFunctions: {
message: PMFunc
}
}
})| Event | Description | Parameters |
|---|---|---|
| message | Fires after a message is sent (and command data is processed, if any) |
msg: The messageres: The results of the command (See CommandHandlerResults) |
| reaction | Fires after a cached message is reacted on (and command data is processed, if any) |
msg: The messageemoji: The Eris data of the emoji reacted withuser: An Eris.User instance of the user that reactedres: The results of the command (See ReactionHandlerResults) |
| prefix | Fires when a guild's custom prefix is changed with the method Agent.setGuildPrefix()
|
guild: The ID of the guild being alteredprefix: The prefix being setoldPrefix: The old prefix |
| permission | Fired when a guild role's authority level is changed with the method Agent.updatePermission()
|
guild: The ID of the role being altered's guildrole: The ID of the role being alteredlevel: The new authority level of the roleoldLevel: The old authority level of the role |