Interaction problem

Hello, a strange thing happend to me. I log interaction.channel in interactioncreate event and it's set, then i log it in my command, wich is executed few lines after the first log, and now it's not set anymore InteractionCreate event:
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if(!interaction.guild) return;
if(interaction.type === InteractionType.ApplicationCommand){

//some javascript code

console.log("INTERACTION CREATE : " + JSON.stringify(interaction.channel))
}
}
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if(!interaction.guild) return;
if(interaction.type === InteractionType.ApplicationCommand){

//some javascript code

console.log("INTERACTION CREATE : " + JSON.stringify(interaction.channel))
}
}
output:
INTERACTION CREATE : {"type":0,"guild":"1250125877203701841","guildId":"1250125877203701841","permissionOverwrites":["1250125877203701841","1260738028658364551","1260738028062638151","1260738030206189660"],"messages":[],"threads":[],"nsfw":false,"flags":0,"id":"1262593119648747642","name":"🛬・welcome","rawPosition":0,"parentId":"1262593112547659818","topic":null,"lastMessageId":null,"defaultThreadRateLimitPerUser":null,"rateLimitPerUser":0,"createdTimestamp":1721096057570}
INTERACTION CREATE : {"type":0,"guild":"1250125877203701841","guildId":"1250125877203701841","permissionOverwrites":["1250125877203701841","1260738028658364551","1260738028062638151","1260738030206189660"],"messages":[],"threads":[],"nsfw":false,"flags":0,"id":"1262593119648747642","name":"🛬・welcome","rawPosition":0,"parentId":"1262593112547659818","topic":null,"lastMessageId":null,"defaultThreadRateLimitPerUser":null,"rateLimitPerUser":0,"createdTimestamp":1721096057570}
auto.js:
module.exports = {

data: new SlashCommandBuilder()

.setName('auto')

.setDescription('automatically create channels'),

async execute(interaction) {


//some javascript code

console.log(JSON.stringify(interaction.channel))

}
}
module.exports = {

data: new SlashCommandBuilder()

.setName('auto')

.setDescription('automatically create channels'),

async execute(interaction) {


//some javascript code

console.log(JSON.stringify(interaction.channel))

}
}
output:
null
null
2 Replies
d.js toolkit
d.js toolkit•4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
monbrey
monbrey•4mo ago
You don't log it, you log a json stringified representation This by design doesn't include nested classes Oh nvm I misread, mobile It's hard to tell other code removed
Want results from more Discord servers?
Add your server