Add bot owner commands for adding/removing servers and dashboard users
This commit is contained in:
parent
cd4b7a2f97
commit
5d13322439
8 changed files with 195 additions and 1 deletions
26
backend/src/plugins/BotControl/commands/AllowServerCmd.ts
Normal file
26
backend/src/plugins/BotControl/commands/AllowServerCmd.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
|
||||
export const AllowServerCmd = botControlCmd({
|
||||
trigger: ["allow_server", "allowserver", "add_server", "addserver"],
|
||||
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, "Server is already allowed!");
|
||||
return;
|
||||
}
|
||||
|
||||
await pluginData.state.allowedGuilds.add(args.guildId);
|
||||
sendSuccessMessage(pluginData, msg.channel, "Server is now allowed to use Zeppelin!");
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue