mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
reaction_roles: add remove_user_reactions option
This commit is contained in:
parent
bf4c6cc25c
commit
f3417313bc
3 changed files with 13 additions and 8 deletions
|
@ -16,6 +16,7 @@ const MIN_AUTO_REFRESH = 1000 * 60 * 15; // 15min minimum, let's not abuse the A
|
||||||
const defaultOptions: PluginOptions<ReactionRolesPluginType> = {
|
const defaultOptions: PluginOptions<ReactionRolesPluginType> = {
|
||||||
config: {
|
config: {
|
||||||
auto_refresh_interval: MIN_AUTO_REFRESH,
|
auto_refresh_interval: MIN_AUTO_REFRESH,
|
||||||
|
remove_user_reactions: true,
|
||||||
|
|
||||||
can_manage: false,
|
can_manage: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -51,13 +51,16 @@ export const AddReactionRoleEvt = reactionRolesEvent({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the reaction after a small delay
|
// Remove the reaction after a small delay
|
||||||
setTimeout(() => {
|
const config = pluginData.config.getForMember(member);
|
||||||
pluginData.state.reactionRemoveQueue.add(async () => {
|
if (config.remove_user_reactions) {
|
||||||
const reaction = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;
|
setTimeout(() => {
|
||||||
const wait = sleep(1500);
|
pluginData.state.reactionRemoveQueue.add(async () => {
|
||||||
await msg.channel.removeMessageReaction(msg.id, reaction, userId).catch(noop);
|
const reaction = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;
|
||||||
await wait;
|
const wait = sleep(1500);
|
||||||
});
|
await msg.channel.removeMessageReaction(msg.id, reaction, userId).catch(noop);
|
||||||
}, 1500);
|
await wait;
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Queue } from "src/Queue";
|
||||||
|
|
||||||
export const ConfigSchema = t.type({
|
export const ConfigSchema = t.type({
|
||||||
auto_refresh_interval: t.number,
|
auto_refresh_interval: t.number,
|
||||||
|
remove_user_reactions: t.boolean,
|
||||||
can_manage: t.boolean,
|
can_manage: t.boolean,
|
||||||
});
|
});
|
||||||
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue