fix bot crash on bot response with only text

This commit is contained in:
SowinskiBraeden committed 2022-09-24 10:41:30 -07:00
1 parent 8fbe602597
commit 7fbbd2d70f
15 files changed
+20 -20

No files matched your search

+2 -2
View File
@@ -54,7 +54,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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 const missing = !GuildDB.dispatchChannel && !GuildDB.dispatcherRole
@@ -112,7 +112,7 @@ module.exports = {
} catch (err) { } 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(`<@${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.' });
}, },
}, },
} }
+3 -3
View File
@@ -54,7 +54,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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 const missing = !GuildDB.dispatchChannel && !GuildDB.dispatcherRole
@@ -110,9 +110,9 @@ module.exports = {
try { try {
channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 911 call!`, embeds: [embed911], components: [opt] }); channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 911 call!`, embeds: [embed911], components: [opt] });
} catch (err) { } 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!' });
}, },
}, },
} }
+1 -1
View File
@@ -111,7 +111,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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); let banking = await client.dbo.collection("banks").findOne({"banking.userID": interaction.member.user.id}).then(banking => banking);
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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) { if (!GuildDB.officerRole) {
+1 -1
View File
@@ -151,7 +151,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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); let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
+3 -3
View File
@@ -29,7 +29,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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() const actionEmbed = new EmbedBuilder()
@@ -50,9 +50,9 @@ module.exports = {
try { try {
channel.send({ embeds: [actionEmbed] }); channel.send({ embeds: [actionEmbed] });
} catch (err) { } 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 { } else {
return interaction.send({ content: 'Action performed', embeds: [actionEmbed] }); return interaction.send({ content: 'Action performed', embeds: [actionEmbed] });
} }
+1 -1
View File
@@ -52,7 +52,7 @@ module.exports = {
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) 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('>', ''); const targetUserID = args[2].value.replace('<@!', '').replace('>', '');
let banking = await client.dbo.collection("banks").findOne({"banking.userID": targetUserID}).then(banking => banking); let banking = await client.dbo.collection("banks").findOne({"banking.userID": targetUserID}).then(banking => banking);
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = {
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) 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('>', ''); const targetUserID = args[0].value.replace('<@!', '').replace('>', '');
+1 -1
View File
@@ -37,7 +37,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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('>', ''); let targetUserID = args[0].value.replace('<@!', '').replace('>', '');
+1 -1
View File
@@ -379,7 +379,7 @@ module.exports = {
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true; if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) 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') { if (args[0].name == 'allowed_channels') {
const channelid = args[0].options[0].options[0].value; const channelid = args[0].options[0].options[0].value;
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = {
} catch (err) { } 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(`<@${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 { } else {
return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] }); return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] });
} }
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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); let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
+1 -1
View File
@@ -21,7 +21,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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) { if (GuildDB.incomeRoleStatus) {
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = {
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { 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 => { const hasWorkRole = GuildDB.incomeRoles.some(data => {
+1 -1
View File
@@ -2,7 +2,7 @@ require('dotenv').config();
module.exports = { module.exports = {
Dev: "PROD.", Dev: "PROD.",
Version: "12.4.4", Version: "12.4.5",
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
DefaultPrefix: "?", DefaultPrefix: "?",
ServerID: "955668596745461830", ServerID: "955668596745461830",