3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 13:55:03 +00:00

Fixes, refactoring and PR feedback

This commit is contained in:
Lily Bergonzat 2024-04-15 15:51:45 +02:00
parent 0be54912c4
commit 893a77d562
202 changed files with 1037 additions and 1069 deletions

View file

@ -18,21 +18,19 @@ export const AddServerFromInviteCmd = botControlCmd({
async run({ pluginData, message: msg, args }) {
const invite = await resolveInvite(pluginData.client, args.inviteCode, true);
if (!invite || !isGuildInvite(invite)) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Could not resolve invite"); // :D
void msg.channel.send("Could not resolve invite"); // :D
return;
}
const existing = await pluginData.state.allowedGuilds.find(invite.guild.id);
if (existing) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is already allowed!");
void msg.channel.send("Server is already allowed!");
return;
}
const { result, explanation } = await isEligible(pluginData, args.user, invite);
if (!result) {
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(msg, `Could not add server because it's not eligible: ${explanation}`);
msg.channel.send(`Could not add server because it's not eligible: ${explanation}`);
return;
}
@ -53,8 +51,6 @@ export const AddServerFromInviteCmd = botControlCmd({
);
}
pluginData
.getPlugin(CommonPlugin)
.sendSuccessMessage(msg, "Server was eligible and is now allowed to use Zeppelin!");
msg.channel.send("Server was eligible and is now allowed to use Zeppelin!");
},
});