mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-20 16:25:03 +00:00
Finish preliminary rework, ready to test
This commit is contained in:
parent
57893e7f76
commit
d0a1beb809
177 changed files with 854 additions and 707 deletions
|
@ -4,6 +4,7 @@ import { addMemberPendingRoleChange } from "../util/addMemberPendingRoleChange";
|
|||
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { Message } from "discord.js";
|
||||
|
||||
const CLEAR_ROLES_EMOJI = "❌";
|
||||
|
||||
|
@ -12,9 +13,9 @@ export const AddReactionRoleEvt = reactionRolesEvt({
|
|||
|
||||
async listener(meta) {
|
||||
const pluginData = meta.pluginData;
|
||||
const msg = meta.args.message as Message;
|
||||
const emoji = meta.args.emoji;
|
||||
const userId = meta.args.member.id;
|
||||
const msg = meta.args.reaction.message as Message;
|
||||
const emoji = meta.args.reaction.emoji;
|
||||
const userId = meta.args.user.id;
|
||||
|
||||
if (userId === pluginData.client.user!.id) {
|
||||
// Don't act on own reactions
|
||||
|
@ -39,7 +40,7 @@ export const AddReactionRoleEvt = reactionRolesEvt({
|
|||
// User reacted with a reaction role emoji -> add the role
|
||||
const matchingReactionRole = await pluginData.state.reactionRoles.getByMessageAndEmoji(
|
||||
msg.id,
|
||||
emoji.id || emoji.name,
|
||||
emoji.id || emoji.name!,
|
||||
);
|
||||
if (!matchingReactionRole) return;
|
||||
|
||||
|
@ -59,9 +60,8 @@ export const AddReactionRoleEvt = reactionRolesEvt({
|
|||
if (config.remove_user_reactions) {
|
||||
setTimeout(() => {
|
||||
pluginData.state.reactionRemoveQueue.add(async () => {
|
||||
const reaction = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;
|
||||
const wait = sleep(1500);
|
||||
await msg.channel.removeMessageReaction(msg.id, reaction, userId).catch(noop);
|
||||
await meta.args.reaction.remove().catch(noop);
|
||||
await wait;
|
||||
});
|
||||
}, 1500);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue