{"size": 1158, "ext": "js", "max_stars_repo_path": "events/messageReactionRemove.js", "max_stars_repo_name": "samsamson33/Suggester", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "events/messageReactionRemove.js", "max_issues_repo_name": "samsamson33/Suggester", "max_issues_repo_issues_event_min_datetime": "2020-04-10T15:55:16.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-10T15:55:16.000Z", "max_forks_repo_path": "events/messageReactionRemove.js", "max_forks_repo_name": "samsamson33/Suggester", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 68.1176470588, "max_line_length": 369, "alphanum_fraction": 0.7020725389}
const { dbQueryNoNew } = require("../utils/db");
const { editFeedMessage } = require("../utils/actions");
module.exports = async (Discord, client, messageReaction, user) => {
	if (user.id === client.user.id) return;
	const nodeEmoji = require("node-emoji");
	if (messageReaction.message.partial) messageReaction.message = await messageReaction.message.fetch();
	let db = await messageReaction.message.guild.db;

	let suggestion = await dbQueryNoNew("Suggestion", { id: messageReaction.message.guild.id, messageId: messageReaction.message.id });
	if (!suggestion) return;

	let emotes = [suggestion.emojis.up.match(/a?:?.+:(\d+)/) ? suggestion.emojis.up.match(/a?:?.+:(\d+)/)[1] : suggestion.emojis.up, suggestion.emojis.mid.match(/a?:?.+:(\d+)/) ? suggestion.emojis.mid.match(/a?:?.+:(\d+)/)[1] : suggestion.emojis.mid, suggestion.emojis.down.match(/a?:?.+:(\d+)/) ? suggestion.emojis.down.match(/a?:?.+:(\d+)/)[1] : suggestion.emojis.down];
	if (!emotes.includes(nodeEmoji.hasEmoji(messageReaction.emoji.name) ? messageReaction.emoji.name : messageReaction.emoji.id)) return;

	await editFeedMessage({ guild: db.config.locale }, suggestion, db, client);
};
