issue with a lock channel command

if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
})
if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
})
why the bot instead of sending the errEmbed when the channel is locked it just runs the rest of the code? (the bot should send the "errEmbed" only if the channel permission "SendMessages" is set to deny)
49 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
it has administrator
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
no errors
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
yeah
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
alr
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
the bot?
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
that's the everyone role id
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
didn't work
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
it doesn't
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
it's message.channel so the same channel where the command is getting ran in
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
wdym
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
yeah
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
why would that be needed
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
no ik simply a command that locks the provided channel, if none is provided it will lock the current channel
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
changing the "sendMessages" permission to "deny"
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
the bot instead of sending the errEmbed when the channel is locked it just runs the rest of the code all the code works perfectly, the only part that doesn't is where the bot checks if the channel is locked what does the bot return when it locks the channel? sorry i was afk i do not use .serialize oh
{
CreateInstantInvite: false,
KickMembers: false,
BanMembers: false,
Administrator: false,
ManageChannels: false,
ManageGuild: false,
AddReactions: false,
ViewAuditLog: false,
PrioritySpeaker: false,
Stream: false,
ViewChannel: false,
SendMessages: false,
SendTTSMessages: false,
ManageMessages: false,
EmbedLinks: false,
AttachFiles: false,
ReadMessageHistory: true,
MentionEveryone: false,
UseExternalEmojis: false,
ViewGuildInsights: false,
Connect: false,
Speak: false,
MuteMembers: false,
DeafenMembers: false,
MoveMembers: false,
UseVAD: false,
ChangeNickname: false,
ManageNicknames: false,
ManageRoles: false,
ManageWebhooks: false,
ManageEmojisAndStickers: false,
UseApplicationCommands: false,
RequestToSpeak: false,
ManageEvents: false,
ManageThreads: false,
CreatePublicThreads: false,
CreatePrivateThreads: false,
UseExternalStickers: false,
SendMessagesInThreads: false,
UseEmbeddedActivities: false,
ModerateMembers: false
}
{
CreateInstantInvite: false,
KickMembers: false,
BanMembers: false,
Administrator: false,
ManageChannels: false,
ManageGuild: false,
AddReactions: false,
ViewAuditLog: false,
PrioritySpeaker: false,
Stream: false,
ViewChannel: false,
SendMessages: false,
SendTTSMessages: false,
ManageMessages: false,
EmbedLinks: false,
AttachFiles: false,
ReadMessageHistory: true,
MentionEveryone: false,
UseExternalEmojis: false,
ViewGuildInsights: false,
Connect: false,
Speak: false,
MuteMembers: false,
DeafenMembers: false,
MoveMembers: false,
UseVAD: false,
ChangeNickname: false,
ManageNicknames: false,
ManageRoles: false,
ManageWebhooks: false,
ManageEmojisAndStickers: false,
UseApplicationCommands: false,
RequestToSpeak: false,
ManageEvents: false,
ManageThreads: false,
CreatePublicThreads: false,
CreatePrivateThreads: false,
UseExternalStickers: false,
SendMessagesInThreads: false,
UseEmbeddedActivities: false,
ModerateMembers: false
}
why did it skip
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
if(!message.member.roles.cache.has(config.moderation.modRole)) return message.delete();
-Carlosđź‘‘
-Carlos👑OP•2y ago
for some reason it doesn't let me
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
file error
-Carlosđź‘‘
-Carlos👑OP•2y ago
vsc detected an error
-Carlosđź‘‘
-Carlos👑OP•2y ago
2 actually
-Carlosđź‘‘
-Carlos👑OP•2y ago
-Carlosđź‘‘
-Carlos👑OP•2y ago
yeah i think
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
no
-Carlosđź‘‘
-Carlos👑OP•2y ago
fixed code
-Carlosđź‘‘
-Carlos👑OP•2y ago
yeah
-Carlosđź‘‘
-Carlos👑OP•2y ago
this again
-Carlosđź‘‘
-Carlos👑OP•2y ago
idk what's wrong with this
if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
}
if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
}
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
-Carlosđź‘‘
-Carlos👑OP•2y ago
if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
})}
if(message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
})}
vsc doesn't detect any error with this, gonna see if it works
if (message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({ embeds: [errEmbed] }).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
})

} else if (flagCheck === true) {else if code here}
if (message.channel.permissionsFor(message.guild.id).has("SendMessages") === false) {
message.channel.send({ embeds: [errEmbed] }).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
return
})

} else if (flagCheck === true) {else if code here}
no longer gives file errors gonna test it now it always return the message.channel.send
Want results from more Discord servers?
Add your server