<commit_before>/**
 * @file messageReactionRemove event
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

module.exports = async (reaction, user) => {
  try {
    // TODO: reaction pinning removal logic
  }
  catch (e) {
    user.client.log.error(e);
  }
};
<commit_msg>events: implement reactionPinning to messageReactionRemove event<commit_after>/**
 * @file messageReactionRemove event
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

module.exports = async (reaction, user) => {
  try {
    if (!reaction.message.guild) return;

    let guildModel = await user.client.database.models.guild.findOne({
      attributes: [ 'reactionPinning' ],
      where: {
        guildID: reaction.message.guild.id
      }
    });

    if (!guildModel) return;

    if (guildModel.dataValues.reactionPinning) {
      let pins = [ '📌', '📍' ];
      if (!pins.includes(reaction.emoji.name)) return;

      let authorizedUsers = reaction.users.filter(user => reaction.message.channel.permissionsFor(user).has('MANAGE_MESSAGES'));

      if (authorizedUsers.size === 0 && reaction.message.pinned) {
        await reaction.message.unpin();
      }
    }
  }
  catch (e) {
    user.client.log.error(e);
  }
};

{'fraction_non_alphanumeric': 0.15340442986054142, 'fraction_numerical': 0.01066447908121411, 'mean_word_length': 3.0397350993377485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1760679', 'n_tokens_mistral': 435, 'n_tokens_neox': 414, 'n_words': 80}