my guild related listeners arent firing but my client ones are

pretty much just the title
29 Replies
iaqi
iaqiOP3w ago
im having a lot of random issues for some reason all my packages are up to date like everytime i run my bot it always says in the logs that it needs to updates the commands except typescript though because i know you cant have that up to date
Seren_Modz 21
Seren_Modz 213w ago
based on what u have included in the title, it sounds like ur missing intents for your guild events
Seren_Modz 21
Seren_Modz 213w ago
i recommend looking at https://discord.com/developers/docs/events/gateway#list-of-intents to see which intents are required for each event
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
iaqi
iaqiOP3w ago
well the event that isnt working is the messagereactionadd event i have that intent enabled
Seren_Modz 21
Seren_Modz 213w ago
could u clarify which intent is enabled?
iaqi
iaqiOP3w ago
i have these enabled
iaqi
iaqiOP3w ago
No description
Seren_Modz 21
Seren_Modz 213w ago
could u also show the messageReactionAdd listener?
iaqi
iaqiOP3w ago
import { Events, Listener } from "@sapphire/framework";
import { ApplyOptions } from "@sapphire/decorators";
import { EmbedBuilder, MessageReaction, User } from "discord.js";

@ApplyOptions<Listener.Options>({
event: Events.MessageReactionAdd,
})
export class MessageReactionAddListener extends Listener {
public async run(messageReaction: MessageReaction, user: User) {
this.container.logger.info("hello");
if (!messageReaction.message.guild || user.bot) return;

this.container.logger.info(messageReaction.emoji.name);

if (messageReaction.emoji.name === "⭐️") {
const starboard = await this.container.prisma.starboard.findUnique({
where: {
guildId: messageReaction.message.guild.id,
},
});

if (!starboard || !starboard.enabled || !starboard.channelId) return;

const starboardChannel = await messageReaction.message.guild.channels.fetch(starboard.channelId);

if (!starboardChannel) return;
this.container.logger.info("hello");

if (messageReaction.count >= starboard.starsRequired && !starboard.starredMessages.includes((messageReaction.message.id))) {
if (!starboardChannel.isSendable()) return;

this.container.logger.info("hello");

await starboardChannel.send({
embeds: [
new EmbedBuilder().setTitle("⭐️").setDescription(messageReaction.message.content).setColor("Gold").setFooter({ text: `⭐️ ${messageReaction.count}`})
]
});

await this.container.prisma.starboard.update({
where: {
guildId: messageReaction.message.guild.id,
},
data: {
starredMessages: {
push: messageReaction.message.id,
},
},
});
}
}
}
}
import { Events, Listener } from "@sapphire/framework";
import { ApplyOptions } from "@sapphire/decorators";
import { EmbedBuilder, MessageReaction, User } from "discord.js";

@ApplyOptions<Listener.Options>({
event: Events.MessageReactionAdd,
})
export class MessageReactionAddListener extends Listener {
public async run(messageReaction: MessageReaction, user: User) {
this.container.logger.info("hello");
if (!messageReaction.message.guild || user.bot) return;

this.container.logger.info(messageReaction.emoji.name);

if (messageReaction.emoji.name === "⭐️") {
const starboard = await this.container.prisma.starboard.findUnique({
where: {
guildId: messageReaction.message.guild.id,
},
});

if (!starboard || !starboard.enabled || !starboard.channelId) return;

const starboardChannel = await messageReaction.message.guild.channels.fetch(starboard.channelId);

if (!starboardChannel) return;
this.container.logger.info("hello");

if (messageReaction.count >= starboard.starsRequired && !starboard.starredMessages.includes((messageReaction.message.id))) {
if (!starboardChannel.isSendable()) return;

this.container.logger.info("hello");

await starboardChannel.send({
embeds: [
new EmbedBuilder().setTitle("⭐️").setDescription(messageReaction.message.content).setColor("Gold").setFooter({ text: `⭐️ ${messageReaction.count}`})
]
});

await this.container.prisma.starboard.update({
where: {
guildId: messageReaction.message.guild.id,
},
data: {
starredMessages: {
push: messageReaction.message.id,
},
},
});
}
}
}
}
Seren_Modz 21
Seren_Modz 213w ago
your other listeners are working so that would suggest that your package.json main is correct if u would like to see more logs and get a better idea what is going on, u could change your logger level from debug to trace
iaqi
iaqiOP3w ago
okay ill see
iaqi
iaqiOP3w ago
No description
iaqi
iaqiOP3w ago
idk why it keeps saying its updating the command data when i havent changed anything and that its found differences
Seren_Modz 21
Seren_Modz 213w ago
that will be differences with what has been deployed to the discord api
iaqi
iaqiOP3w ago
but i have not changed anything in the commands
Seren_Modz 21
Seren_Modz 213w ago
focusing back on the problem with your messageReactionAdd listener, have u managed to update your logger to log traces and see what is happening with listeners?
iaqi
iaqiOP3w ago
well its getting loaded and inserted
Seren_Modz 21
Seren_Modz 213w ago
and nothing at all is happening when u add a reaction in a server that the bot is in? not even the logs show?
iaqi
iaqiOP3w ago
nothing happens
Seren_Modz 21
Seren_Modz 213w ago
may i ask what your package.json main is set to?
iaqi
iaqiOP3w ago
./dist/index.js
iaqi
iaqiOP3w ago
No description
iaqi
iaqiOP3w ago
this is what it looks like
Seren_Modz 21
Seren_Modz 213w ago
could u try deleting the dist folder and trying with a fresh build?
iaqi
iaqiOP3w ago
yeah same issue still applies
iaqi
iaqiOP3w ago
also for some reason it says it took 41 seconds to intialise
No description
Seren_Modz 21
Seren_Modz 213w ago
i just remembered that messageReactionAdd won't fire on uncached messages, unless u were to enable partials have u tried sending a new message after the bot has started and reacting to that?
iaqi
iaqiOP3w ago
let me see using partials fixed it but im still concerned about the other issue
Favna
Favna3w ago
Seeing as this is a starboard you can pretty much just look at the code of @Gemboard https://github.com/sapphiredev/gemboard
GitHub
GitHub - sapphiredev/gemboard: A private starboard bot for the Sapp...
A private starboard bot for the Sapphire server. Contribute to sapphiredev/gemboard development by creating an account on GitHub.
Want results from more Discord servers?
Add your server