3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00
zeppelin/backend/src/plugins/ReactionRoles/commands/RefreshReactionRolesCmd.ts
2020-10-01 01:43:38 +03:00

24 lines
872 B
TypeScript

import { reactionRolesCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { refreshReactionRoles } from "../util/refreshReactionRoles";
export const RefreshReactionRolesCmd = reactionRolesCmd({
trigger: "reaction_roles refresh",
permission: "can_manage",
signature: {
message: ct.messageTarget(),
},
async run({ message: msg, args, pluginData }) {
if (pluginData.state.pendingRefreshes.has(`${args.message.channel.id}-${args.message.messageId}`)) {
sendErrorMessage(pluginData, msg.channel, "Another refresh in progress");
return;
}
await refreshReactionRoles(pluginData, args.message.channel.id, args.message.messageId);
sendSuccessMessage(pluginData, msg.channel, "Reaction roles refreshed");
},
});