Include empty config in add_server bot control command

This commit is contained in:
Dragory 2020-10-10 15:29:23 +03:00
parent eab62acc6b
commit 4ae3ef477a
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 11 additions and 0 deletions

View file

@ -1,6 +1,7 @@
import { botControlCmd } from "../types";
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isSnowflake } from "../../../utils";
export const AllowServerCmd = botControlCmd({
trigger: ["allow_server", "allowserver", "add_server", "addserver"],
@ -20,7 +21,13 @@ export const AllowServerCmd = botControlCmd({
return;
}
if (!isSnowflake(args.guildId)) {
sendErrorMessage(pluginData, msg.channel, "Invalid server ID!");
return;
}
await pluginData.state.allowedGuilds.add(args.guildId);
await pluginData.state.configs.saveNewRevision(`guild-${args.guildId}`, "plugins: {}", msg.author.id);
sendSuccessMessage(pluginData, msg.channel, "Server is now allowed to use Zeppelin!");
},
});