const { Client, Events, GatewayIntentBits, Partials } = require("discord.js")
const { token } = require("./config.json")
const client = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
],
partials: [
Partials.Channel,
],
})
client.on(Events.InteractionCreate, async interaction => {
console.log(interaction.channel.guildId) // pass
await interaction.reply({ content: "content", ephemeral: true })
console.log(interaction.channel.guildId) // sometimes undefined
console.log(interaction.client.channels.resolve(interaction.channelId).guildId) // same
})
client.login(token)
const { Client, Events, GatewayIntentBits, Partials } = require("discord.js")
const { token } = require("./config.json")
const client = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
],
partials: [
Partials.Channel,
],
})
client.on(Events.InteractionCreate, async interaction => {
console.log(interaction.channel.guildId) // pass
await interaction.reply({ content: "content", ephemeral: true })
console.log(interaction.channel.guildId) // sometimes undefined
console.log(interaction.client.channels.resolve(interaction.channelId).guildId) // same
})
client.login(token)