From 1927d3029a5cb90fce9ff131c9bc9bda411ed253 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Wed, 31 May 2023 08:44:42 -0400 Subject: [PATCH] Begin implementing ability to message server owner --- dot-commands/message.js | 11 ++++++----- main.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dot-commands/message.js b/dot-commands/message.js index d0efcaf..a45b19b 100644 --- a/dot-commands/message.js +++ b/dot-commands/message.js @@ -5,9 +5,10 @@ module.exports = { description: "Send a message to a server owner or server", usage: ".message ", async execute(message, commandData) { - if (message.client.guildInfos.has(commandData.args[0])) { - let guildInfo = message.client.guildInfos.get(commandData.args[0]); - const guild = await message.client.guilds.fetch(commandData.args[0]).catch(async e => { + args = commandData.args.split(" "); + if (message.client.guildInfos.has(args[0])) { + let guildInfo = message.client.guildInfos.get(args[0]); + const guild = await message.client.guilds.fetch(args[0]).catch(async e => { await message.reply("I was unable to fetch the guild."); console.error(`Error fetching guild to send message: ${e}`); }); @@ -16,7 +17,7 @@ module.exports = { console.error(`Error fetching guild owner to send message: ${e}`); }); await guildOwner.createDM().then(async dm => { - await dm.send(commandData.args.join(" ")).catch(async e => { + await dm.send(args.join(" ")).catch(async e => { await message.reply("I was unable to send the DM."); console.error(`Error sending DM message: ${e}`); }); @@ -27,7 +28,7 @@ module.exports = { await message.reply("I was unable to fetch the channel."); console.error(`Error fetching channel to send message: ${e}`); }); - await channel.send(commandData.args.join(" ")).catch(async e => { + await channel.send(args.join(" ")).catch(async e => { await message.reply("I was unable to send the message."); console.error(`Error sending message: ${e}`); }); diff --git a/main.js b/main.js index e298c79..17609f3 100755 --- a/main.js +++ b/main.js @@ -101,7 +101,7 @@ client.on('messageCreate', async message => { // Break the message down into its components and analyze it const commandData = fn.dotCommands.getCommandData(message); - if (isDev) console.log(console.log(commandData)); + if (isDev) console.log(commandData); if (commandData.isValid && commandData.isCommand && (message.author.id == process.env.ownerId)) { try {