Skip to content
GitHub

ReactionHandlerAction

enum in meocord/enum Since 4.0.0

enum ReactionHandlerAction

Whether a @ReactionHandler call is for a reaction added to a message or removed from it.

Read it from the handler's second argument when the handler should act on one only, such as counting a vote when it is added and taking it back when it is removed.

Examples

TypeScript
@ReactionHandler('👍')
async vote(reaction: MessageReaction, { action }: ReactionEvent) {
  const change = action === ReactionHandlerAction.ADD ? 'counted' : 'taken back'
  await reaction.message.reply(`Vote ${change}.`)
}

Members

ADD

ADD = 'ADD'

Reaction added to a message.

REMOVE

REMOVE = 'REMOVE'

Reaction removed from a message.

See also

  • ReactionHandler