From e29a54b0d9882f46d5bb9fac1af77582e34c685d Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 5 Jun 2023 17:34:40 -0400 Subject: [PATCH] Add leave command, update util to show guildid --- dot-commands/leave.js | 25 +++++++++++++++++++++++++ modules/utils.js | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 dot-commands/leave.js diff --git a/dot-commands/leave.js b/dot-commands/leave.js new file mode 100644 index 0000000..8792741 --- /dev/null +++ b/dot-commands/leave.js @@ -0,0 +1,25 @@ +const fn = require('../modules/functions.js'); + +module.exports = { + name: "leave", + description: "Leave a server", + usage: " []".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)); + } + } + } +} \ No newline at end of file diff --git a/modules/utils.js b/modules/utils.js index 1f04968..62709bc 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -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(); });