Add leave command, update util to show guildid
This commit is contained in:
parent
5b7c0c4225
commit
e29a54b0d9
25
dot-commands/leave.js
Normal file
25
dot-commands/leave.js
Normal file
@ -0,0 +1,25 @@
|
||||
const fn = require('../modules/functions.js');
|
||||
|
||||
module.exports = {
|
||||
name: "leave",
|
||||
description: "Leave a server",
|
||||
usage: "<serverID> [<serverID>]".leave,
|
||||
permission: "owner",
|
||||
async execute(message, commandData) {
|
||||
if (fn.dotCommands.checkPermissions(this.permission, message.author.id)) {
|
||||
try {
|
||||
// Code Here
|
||||
const serverIds = commandData.args.split(" ");
|
||||
for (let i = 0; i < serverIds.length; i++) {
|
||||
const id = serverIds[i];
|
||||
const guild = await message.client.guilds.fetch(id);
|
||||
await guild.leave();
|
||||
await message.channel.send("Left Guild: " + id);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
await message.reply(fn.builders.errorEmbed("There was an error running the command: " + err));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ client.once('ready', async () => {
|
||||
// watchRequestRates();
|
||||
const guilds = client.guilds.cache;
|
||||
guilds.each(g => {
|
||||
console.log(g.name + "," + g.ownerId);
|
||||
console.log(g.name + "," + g.id + "," + g.ownerId);
|
||||
});
|
||||
process.exit();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user