mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Add proper types to sendErrorMessage()
This commit is contained in:
parent
6896afebfa
commit
edaeb7ef0e
23 changed files with 123 additions and 78 deletions
|
@ -28,22 +28,25 @@ export const MassAddRoleCmd = rolesCmd({
|
|||
|
||||
for (const member of members) {
|
||||
if (!canActOn(pluginData, msg.member, member, true)) {
|
||||
return sendErrorMessage(
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
"Cannot add roles to 1 or more specified members: insufficient permissions",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const roleId = await resolveRoleId(pluginData.client, pluginData.guild.id, args.role);
|
||||
if (!roleId) {
|
||||
return sendErrorMessage(pluginData, msg.channel, "Invalid role id");
|
||||
sendErrorMessage(pluginData, msg.channel, "Invalid role id");
|
||||
return;
|
||||
}
|
||||
|
||||
const config = pluginData.config.getForMessage(msg);
|
||||
if (!config.assignable_roles.includes(roleId)) {
|
||||
return sendErrorMessage(pluginData, msg.channel, "You cannot assign that role");
|
||||
sendErrorMessage(pluginData, msg.channel, "You cannot assign that role");
|
||||
return;
|
||||
}
|
||||
|
||||
const role = pluginData.guild.roles.get(roleId);
|
||||
|
@ -51,7 +54,8 @@ export const MassAddRoleCmd = rolesCmd({
|
|||
pluginData.state.logs.log(LogType.BOT_ALERT, {
|
||||
body: `Unknown role configured for 'roles' plugin: ${roleId}`,
|
||||
});
|
||||
return sendErrorMessage(pluginData, msg.channel, "You cannot assign that role");
|
||||
sendErrorMessage(pluginData, msg.channel, "You cannot assign that role");
|
||||
return;
|
||||
}
|
||||
|
||||
const membersWithoutTheRole = members.filter(m => !m.roles.includes(roleId));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue