import { EventHandler } from '../utils/types';
import { MessageReaction, User } from 'discord.js';
import { context } from '../config/context';

const event: EventHandler = {
  name: 'messageReactionAdd',
  async execute(reaction: MessageReaction, user: User) {
    try {
      if (reaction.partial) await reaction.fetch();
    } catch {
      return;
    }
    await context.reactionRoles.handleReaction(reaction, user, true);
  }
};

export default event;
