#Line 33 creates the event yes but it
1 messages · Page 1 of 1 (latest)
What makes me think that the client is not receiving the events is the fact that Raw and Debug never fire when clicking the button. They just sit quite until a heartbeat occurrs.
You could really replace response with interaction per the code in the documentation. I just used that generically across all of the events to see what was actually firing when I clicked the button.
you shouldn't be listening to Raw in the first place, a button interaction should always fire an InteractionCreate event unless you are missing the Guilds intent
and your interactionCreate event handler how is it
I was only listening to raw to see if something was happening around the interaction. But it dead silent when clicking the button.
# Starting the application
Debug
Debug
Debug
Debug
Debug
Debug
Raw
Debug
Debug
Debug
Raw
Debug
Debug
Raw
Debug
Client ready
Raw
Debug
Raw
# I send "asdf" message
MessageCreate message other than 'Button?' seen
Raw
# I send "Button?" message
MessageCreate message received for Button?
Raw
# Bot sends message with Button
MessageCreate message other than 'Button?' seen
# I click the button and nothing happens
# I send "asdf" message
Raw
MessageCreate message other than 'Button?' seen
okay but show me your interactionCreate handler
client.on(
Events.InteractionCreate,
response => console.debug(
"InteractionCreate",
response
)
);
Split for readability there.
I just want to know it's being called.
Log something… anything.
But it logs nothing. I can send message and log that I saw them without issue.
you sure you imported Events correctly? which version of the library are you using?
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, Client, Events, GatewayIntentBits } from "discord.js";
Version 14.9.0
If Events was imported incorrectly, I would fully expect the MessageCreate handler to not work, but it does.
Okay hmmmmm
can you just send the full script hiding your token
"use strict";
// Third Party
import "dotenv/config";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, Client, Events, GatewayIntentBits } from "discord.js";
// Project
import { AppConfig } from "./config.js";
const config = new AppConfig(process.env);
const client = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.MessageContent
]
});
client.login(config.discordToken);
client.once(Events.ClientReady, instance => console.debug(`Client ready`));
client.on(Events.Error, response => console.debug("Error"));
client.on(Events.Warn, response => console.debug("Warn"));
client.on(Events.Debug, response => console.debug("Debug"));
client.on(Events.Raw, response => console.debug("Raw"));
client.on(Events.InteractionCreate, response => console.debug("InteractionCreate", response));
client.on(Events.MessageCreate, message => {
if (message.content === "Button?") {
console.debug("MessageCreate", "message received for Button?");
return message.reply({
components: [
new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("select-test")
.setLabel("Test Button")
.setStyle(ButtonStyle.Primary)
)
],
content: "Test button creation."
});
} else {
console.debug("MessageCreate", "message other than 'Button?' seen");
}
});
AppConfig is just a wrapper for the process.env parsing.
hmm
Yeah… It seems like it should work.
That's why I wonder if something was missing from the setup/config with the Discord Server, but it has Admin permissions and was registered using their suggested URL.
can you instead of using console.debug just do response.reply("something")
save and restart

this is weird af, I have no idea what is happening
Yeah!
Mind. Boggling.
Literally cannot even with this. o_O
Everything suggests it should work. But nothing…
Just zero events.
I tried the raw string in place. Nope.
I tried logging all events listed on the Events enum, nope.
Are there some magic bits in the Application/Bot registration within Discord itself I need to set before inviting it? 🤔
Like this stuff:
the only one I know is the application.commands scope but that one is supposed to just let your bot update and create slash commands on the guild, i dont think that one should affect buttons and other interactions
const { getEventListeners } = require("node:events");
const listeners = getEventListeners(client, "interactionCreate");
log listeners. Put this code in ur message event
The MessageCreate event?
Added:
client.on(Events.MessageCreate, message => {
console.debug(events.getEventListeners(client, "interactionCreate"));
console.debug(events.getEventListeners(client, Events.InteractionCreate)
.map(f => f.toString())
);
Sent an asdf message to the channel for the message event to fire.
That means the event is created, just not getting fired, now this issue is absolutely unsolvable
Try creating a collector on the message and see ìf it get the interaction
Hrm…
Suggestion for @nocturne sequoia:
Additional Information: Additions - InteractionCollector
read more
Suggestion for @nocturne sequoia:
Additional Information: Additions - InteractionCollector
read more
It looks like it just auto-collects the message but not the intereaction.