3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Add bot owner commands for adding/removing servers and dashboard users

This commit is contained in:
Dragory 2020-10-10 14:21:59 +03:00
parent cd4b7a2f97
commit 5d13322439
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
8 changed files with 195 additions and 1 deletions

View file

@ -0,0 +1,28 @@
import { botControlCmd } from "../types";
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { noop } from "../../../utils";
export const DisallowServerCmd = botControlCmd({
trigger: ["disallow_server", "disallowserver", "remove_server", "removeserver"],
permission: null,
config: {
preFilters: [isOwnerPreFilter],
},
signature: {
guildId: ct.string(),
},
async run({ pluginData, message: msg, args }) {
const existing = await pluginData.state.allowedGuilds.find(args.guildId);
if (!existing) {
sendErrorMessage(pluginData, msg.channel, "That server is not allowed in the first place!");
return;
}
await pluginData.state.allowedGuilds.remove(args.guildId);
await pluginData.client.leaveGuild(args.guildId).catch(noop);
sendSuccessMessage(pluginData, msg.channel, "Server removed!");
},
});