Message interaction is null

is there still a way to get the interaction associated with the message? Because i have a bot where if you use a slash command it responds with a message with buttons. I want to limit those buttons to only the person why send the intiial interaction, but for some reason when i fetch the msg or get it from the button interaction the interaction associated with the message is null (unless its the first time you click the button for whatever reason) Now short of just making the custom id of the buttons the persons id, is there any way to get the interaction, or a wait to get who send the initial interaction.
4 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! - ✅ Marked as resolved by OP
sbot50
sbot50•4mo ago
I dont see how most of this is relevant but ok Node version: v22.3.0 DiscordJS version: 14.15.3 Might be a dc api issue, seeing as theyre moving to inteaction_metadata or smth Code:
const guild = await this.client.guilds.cache.get(interaction.guildId);
const channel = await guild.channels.cache.get(interaction.channelId);
const msg = await channel.messages.fetch(interaction.message.id);
console.log(interaction.message);
console.log(msg);
const guild = await this.client.guilds.cache.get(interaction.guildId);
const channel = await guild.channels.cache.get(interaction.channelId);
const msg = await channel.messages.fetch(interaction.message.id);
console.log(interaction.message);
console.log(msg);
The stack trace really isnt needed, it just that in the logs the value of interaction for the msg object is null unless its the first button press.
Svitkona
Svitkona•4mo ago
seems to work fine for me, even through multiple button presses
sbot50
sbot50•4mo ago
I found out that im an idiot, i recoded it wrong and it summons a new msg. I'll mark this as closed
Want results from more Discord servers?
Add your server