Discord Interactions | Get message

Good day, guys!

I would like to ask about the possibility of receiving message in interactionCreate. Maybe someone has some suggestions.

These are callback events right? So I think an interaction is passed along through interactionCreate and a message is passed along through messageCreate.

You cannot add interactionCreate to messageCreate. It just won’t work.

Wasn’t that my point? :slight_smile: They are “callbacks” it is an interface which you need to follow.

Hey!

Just looking at the discord docs - and I don’t know if Discord.js has caught up with this yet - it looks like the interaction object should contain the message?

Handling interaction create:

Interaction structure:

Notable part:

FIELD TYPE DESCRIPTION
id snowflake id of the interaction
application_id snowflake id of the application this interaction is for
type interaction type the type of interaction
data?* application command interaction data the command data payload
guild_id? snowflake the guild it was sent from
channel_id? snowflake the channel it was sent from
member?** guild member object guild member data for the invoking user, including permissions
user? user object user object for the invoking user, if invoked in a DM
token string a continuation token for responding to the interaction
version integer read-only property, always 1
message? message object for components, the message they were attached to

Does this mean anything to you? :slight_smile:

Edit: I also found this: https://gist.github.com/advaith1/287e69c3347ef5165c0dbde00aa305d2

Hi… I believe the question mark next to marks it as conditional. The slash command uses interactions but does not supply a message. They aren’t responding to a message so that makes a lot of sense.

Also, per my recommendation (in another response) to use JSON.stringify() to inspect things. I just made it considerably easier for myself by adding it as a logging option in my logger library. I love not having to re-write code :slight_smile:

This makes it quite easy to confirm there was no message property in the interaction received.
.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.