Add leave command, update util to show guildid

This commit is contained in:
Skylar Grant 2023-06-05 17:34:40 -04:00
parent 5b7c0c4225
commit e29a54b0d9
2 changed files with 26 additions and 1 deletions

25
dot-commands/leave.js Normal file
View 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));
}
}
}
}

View File

@ -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();
});