add missing data check
This commit is contained in:
3 files changed
+4
-4
No files matched your search
@@ -23,7 +23,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
if (guild.server.hasCustomChannels==false) {
|
if (client.exists(guild.server.hasCustomChannels) || !guild.server.hasCustomChannels) {
|
||||||
return interaction.send({ content: 'There are no channels set for the bot.' });
|
return interaction.send({ content: 'There are no channels set for the bot.' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = {
|
|||||||
return interaction.send({ content: `Uh Oh! The role <@&${args[0].value}> connot be found.` });
|
return interaction.send({ content: `Uh Oh! The role <@&${args[0].value}> connot be found.` });
|
||||||
} else {
|
} else {
|
||||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
if (guild.server.hasCustomRoles==false) return interaction.send({ content: `There are no roles to be removed.` });
|
if (!client.exists(guild.server.hasCustomRoles) || !guild.server.hasCustomRoles) return interaction.send({ content: `There are no roles to be removed.` });
|
||||||
if (!guild.server.allowedRoles.includes(roleid)) return interaction.send({ content: `The role <@&${args[0].value}> is not added to your roles.` });
|
if (!guild.server.allowedRoles.includes(roleid)) return interaction.send({ content: `The role <@&${args[0].value}> is not added to your roles.` });
|
||||||
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
||||||
if (guild.server.allowedRoles[i]==roleid) {
|
if (guild.server.allowedRoles[i]==roleid) {
|
||||||
|
|||||||
+2
-2
@@ -21,9 +21,9 @@ module.exports = {
|
|||||||
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
return interaction.send({ content: `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 guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
if (guild.server.hasCustomRoles==false) {
|
if (!client.exists(guild.server.hasCustomRoles) || !guild.server.hasCustomRoles) {
|
||||||
return interaction.send({ content: 'There are no roles set for the bot.' });
|
return interaction.send({ content: 'There are no roles set for the bot.' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user