channel.nsfw returns undefined if the channel is not nsfw
See original GitHub issueHello,i was wondering because if a channel is not nsfw it returns undefined
this is a code sample
module.exports = {
name: 'channel-info',
execute(message, args) {
let channel = message.guild.channels.cache.find(channel => channel.name === 'Public Channel')
message.channel.send(`Nsfw: ${channel.nsfw}`)
}
this is my code:
const Discord = require('discord.js')
module.exports = {
name: 'channel-info',
execute(message, args) {
if (!message.member.hasPermission('MANAGE_CHANNELS')) return message.channel.send(`${message.author.username} Non Hai Il Permesso Di Fare Il Comando __**channel-info**__`)
if(!message.guild.me.hasPermission('MANAGE_CHANNELS')) return message.channel.send('Non Ho Il Permesso Di Vedere Le Informazioni Di Un Canale')
let Nomecanale = message.content.substring(message.content.indexOf(' ')+1)
let canale = message.guild.channels.cache.find(channel => channel.name === (Nomecanale))
if(!canale) return message.channel.send('Canale Non Trovato')
const channelinfo = new Discord.MessageEmbed()
.setColor('ff0000')
.setTitle(`Ecco Le Informazioni Del Canale: ${canale.name}`)
.setDescription(`**Nome: ${canale.name}\nDescrizione: ${canale.topic}\nCategoria: ${canale.parent}\nTipo: ${canale.type}\nPosizione: ${canale.position}\nID: ${canale.id}\nSlowmode: ${canale.rateLimitPerUser}\nNsfw: ${canale.nsfw}\nVelocità Di Trasmissione: ${canale.bitrate}**`)
.setTimestamp()
.setFooter(`Comando Eseguito Da: ${message.author.username}`);
message.channel.send(channelinfo);
}
}
discord.js version: v12.2.0
node.js version: v12.16.2
operating system: Windows 7
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Cannot read property 'nsfw' of undefined - discord.js
As the error states, message.channel is undefined . Check the value of the second argument you pass into run() . – Bucket. Mar...
Read more >Check if a channel is NSFW and if it is send a message | Rold
Check if a channel is NSFW and if it is send a message. This snippet does not contain any NSFW, it only checks...
Read more >Updating from v12 to v13
Threads are a new type of sub-channel that can be used to help separate ... The ClientUser#setActivity method no longer returns a Promise....
Read more >hikari.channels - hikari 2.0.0.dev113 documentation
Return the channel ID of the channel being followed. ... before hikari.undefined. ... If provided, whether the channel should be marked as NSFW...
Read more >How To Create NSFW Channels on Discord - YouTube
How to create NSFW channels on Discord? In this tutorial, I show you how to make a NSFW channel on Discord in both...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No even if its a text channel it returns undefined
ok i reopened the issue