From 7fbbd2d70f6d637f7736c7213e9d8537484d059a Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 24 Sep 2022 10:41:30 -0700 Subject: [PATCH] fix bot crash on bot response with only text --- commands/311.js | 4 ++-- commands/911.js | 6 +++--- commands/bank.js | 2 +- commands/fine.js | 2 +- commands/inventory.js | 2 +- commands/me.js | 6 +++--- commands/money.js | 2 +- commands/reset.js | 2 +- commands/search.js | 2 +- commands/settings.js | 2 +- commands/tweet.js | 2 +- commands/wallet.js | 2 +- commands/work-roles.js | 2 +- commands/work.js | 2 +- config/config.js | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/commands/311.js b/commands/311.js index a7c2740..16b3af0 100644 --- a/commands/311.js +++ b/commands/311.js @@ -54,7 +54,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } const missing = !GuildDB.dispatchChannel && !GuildDB.dispatcherRole @@ -112,7 +112,7 @@ module.exports = { } catch (err) { return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `) } - return interaction.send('A report has been sent via 311.'); + return interaction.send({ content: 'A report has been sent via 311.' }); }, }, } \ No newline at end of file diff --git a/commands/911.js b/commands/911.js index 0a7c9d5..efaa584 100644 --- a/commands/911.js +++ b/commands/911.js @@ -54,7 +54,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } const missing = !GuildDB.dispatchChannel && !GuildDB.dispatcherRole @@ -110,9 +110,9 @@ module.exports = { try { channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 911 call!`, embeds: [embed911], components: [opt] }); } catch (err) { - return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `) + return interaction.send({ content: `<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required.` }) } - return interaction.send('911 Alerted!'); + return interaction.send({ content: '911 Alerted!' }); }, }, } \ No newline at end of file diff --git a/commands/bank.js b/commands/bank.js index 202f5de..91cc041 100644 --- a/commands/bank.js +++ b/commands/bank.js @@ -111,7 +111,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } let banking = await client.dbo.collection("banks").findOne({"banking.userID": interaction.member.user.id}).then(banking => banking); diff --git a/commands/fine.js b/commands/fine.js index 5b7bab8..6c654bb 100644 --- a/commands/fine.js +++ b/commands/fine.js @@ -38,7 +38,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } if (!GuildDB.officerRole) { diff --git a/commands/inventory.js b/commands/inventory.js index 133f960..9eb53f6 100644 --- a/commands/inventory.js +++ b/commands/inventory.js @@ -151,7 +151,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory); diff --git a/commands/me.js b/commands/me.js index b78760f..d81e092 100644 --- a/commands/me.js +++ b/commands/me.js @@ -29,7 +29,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } const actionEmbed = new EmbedBuilder() @@ -50,9 +50,9 @@ module.exports = { try { channel.send({ embeds: [actionEmbed] }); } catch (err) { - return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `) + return interaction.send({ content: `<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required.` }) } - return interaction.send('Action performed'); + return interaction.send({ content: 'Action performed' }); } else { return interaction.send({ content: 'Action performed', embeds: [actionEmbed] }); } diff --git a/commands/money.js b/commands/money.js index 09b3379..ea8a3ca 100644 --- a/commands/money.js +++ b/commands/money.js @@ -52,7 +52,7 @@ module.exports = { if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true; - if (!canUseCommand) return interaction.send('You don\'t have the permissions to use this command.'); + if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' }); const targetUserID = args[2].value.replace('<@!', '').replace('>', ''); let banking = await client.dbo.collection("banks").findOne({"banking.userID": targetUserID}).then(banking => banking); diff --git a/commands/reset.js b/commands/reset.js index e53eaed..76a2eef 100644 --- a/commands/reset.js +++ b/commands/reset.js @@ -33,7 +33,7 @@ module.exports = { if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true; - if (!canUseCommand) return interaction.send('You don\'t have the permissions to use this command.'); + if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' }); const targetUserID = args[0].value.replace('<@!', '').replace('>', ''); diff --git a/commands/search.js b/commands/search.js index 93bc837..191e0fb 100644 --- a/commands/search.js +++ b/commands/search.js @@ -37,7 +37,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } let targetUserID = args[0].value.replace('<@!', '').replace('>', ''); diff --git a/commands/settings.js b/commands/settings.js index 87168d5..4fca7e6 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -379,7 +379,7 @@ module.exports = { if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true; - if (!canUseCommand) return interaction.send('You don\'t have the permissions to use this command.'); + if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' }); if (args[0].name == 'allowed_channels') { const channelid = args[0].options[0].options[0].value; diff --git a/commands/tweet.js b/commands/tweet.js index 349d765..2a8016e 100644 --- a/commands/tweet.js +++ b/commands/tweet.js @@ -57,7 +57,7 @@ module.exports = { } catch (err) { return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `) } - return interaction.send('Tweeted!'); + return interaction.send({ content: 'Tweeted!' }); } else { return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] }); } diff --git a/commands/wallet.js b/commands/wallet.js index 80274d5..6e20d6e 100644 --- a/commands/wallet.js +++ b/commands/wallet.js @@ -54,7 +54,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory); diff --git a/commands/work-roles.js b/commands/work-roles.js index 5985052..835ef54 100644 --- a/commands/work-roles.js +++ b/commands/work-roles.js @@ -21,7 +21,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } if (GuildDB.incomeRoleStatus) { diff --git a/commands/work.js b/commands/work.js index b336b1e..b9b7fd8 100644 --- a/commands/work.js +++ b/commands/work.js @@ -23,7 +23,7 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } const hasWorkRole = GuildDB.incomeRoles.some(data => { diff --git a/config/config.js b/config/config.js index cd5c408..f8b6df7 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ require('dotenv').config(); module.exports = { Dev: "PROD.", - Version: "12.4.4", + Version: "12.4.5", Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot DefaultPrefix: "?", ServerID: "955668596745461830",