mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Custom Events fixes (#255)
This commit is contained in:
parent
3385841702
commit
f2f246ee84
2 changed files with 8 additions and 6 deletions
|
@ -51,7 +51,7 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
|
||||||
}
|
}
|
||||||
|
|
||||||
const values = createTypedTemplateSafeValueContainer({
|
const values = createTypedTemplateSafeValueContainer({
|
||||||
...args,
|
...safeArgs,
|
||||||
msg: messageToTemplateSafeMessage(message),
|
msg: messageToTemplateSafeMessage(message),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,11 @@ export async function addRoleAction(
|
||||||
if (event.trigger.type === "command" && !canActOn(pluginData, eventData.msg.member, target)) {
|
if (event.trigger.type === "command" && !canActOn(pluginData, eventData.msg.member, target)) {
|
||||||
throw new ActionError("Missing permissions");
|
throw new ActionError("Missing permissions");
|
||||||
}
|
}
|
||||||
|
const rolesToAdd = (Array.isArray(action.role) ? action.role : [action.role]).filter(
|
||||||
const rolesToAdd = Array.isArray(action.role) ? action.role : [action.role];
|
id => !target.roles.cache.has(id),
|
||||||
await target.edit({
|
);
|
||||||
roles: Array.from(new Set([...target.roles.cache.values(), ...rolesToAdd])) as Snowflake[],
|
if (rolesToAdd.length === 0) {
|
||||||
});
|
throw new ActionError("Target already has the role(s) specified");
|
||||||
|
}
|
||||||
|
await target.roles.add(rolesToAdd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue