MessageCreate Event isn't working

This is the first listener Im creating I've read the documentation 50 times imo and checked out the examples and I am still confused
import { Events, Listener } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class UserEvent extends Listener<typeof Events.MessageCreate> {
public override async run(msg: Message) {
try {
this.container.logger.info(`Message sent by ${msg.author.username} in ${msg.guild?.name} (${msg.guildId})`);

} catch (error) {
this.container.logger.fatal(error);
}
}
}
import { Events, Listener } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class UserEvent extends Listener<typeof Events.MessageCreate> {
public override async run(msg: Message) {
try {
this.container.logger.info(`Message sent by ${msg.author.username} in ${msg.guild?.name} (${msg.guildId})`);

} catch (error) {
this.container.logger.fatal(error);
}
}
}
Solution:
you either have to name it messageCreate.<ext> or add a constructor with name: Events.MessageCreate (which resolves to name: 'messageCreate'
B
BossDaily412d ago
NO error, or anything shows up in console
const client = new SapphireClient({
defaultPrefix: '!',
regexPrefix: /^(hey +)?bot[,! ]/i,
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug
},
shards: 'auto',
intents: [
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Channel],
loadMessageCommandListeners: true
});
const client = new SapphireClient({
defaultPrefix: '!',
regexPrefix: /^(hey +)?bot[,! ]/i,
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug
},
shards: 'auto',
intents: [
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Channel],
loadMessageCommandListeners: true
});
here is the client I have MessageContent intent
B
BossDaily412d ago
F
Favna412d ago
name of the file?
Solution
F
Favna412d ago
you either have to name it messageCreate.<ext> or add a constructor with name: Events.MessageCreate (which resolves to name: 'messageCreate'
B
BossDaily412d ago
it worked thx
Want results from more Discord servers?
Add your server
More Posts
How big is the difference between xyz.cache.get() and await xzy.fetch()?fetch returns the cached thing aswell if it exists, so except the Promise difference i see not reallNOT WORK SAPPHIREwhy not work bot commands?Throwing on unhandled interactionHey, I just wanted to quickly check this idea - If I assign a listener to interaction create and theReply During CooldownCan I make the bot reply with the remaining time of cooldown delay ?messageUpdate event not Triggering```ts import { Listener } from '@sapphire/framework'; import type { Message } from 'discord.js'; exp'"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhookFetchMError: '"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhooMonoreposDoes Sapphire work and play nice with monorepos?Question regarding slash commands / aliasesHi, is there a way for me to register command aliases as slash commands as well? For example: Commandisable commands by dashboard.I want to disable commands through dashboard so, is there any way to dynamically disable commands ?What is the difference between response.status and response.statusCode ?When using the API Plugin of Sapphire.Hey what is DEVELOPMENT MODE and how do I disable itI tried setting the Node_Env to something else but it did not change it in the consoleBotList Autopost of stats is not workingI am using the bot list plugin https://github.com/devtomio/sapphire-plugin-botlist I set everything Miss matching objects on permission setting.Typescript says that permissionOverwrites does not exits in GuildBasedChannel, even tho it exists, irequiredClientPermissions check always rejectingWhile `requiredUserPermissions: ['ManageRoles']` works great. The client check `requiredClientPermisUnable to get member data from users that have left / kickedHi, I am trying to get data from members who have left the discord server or have been kicked. But ICatch all chat input command errors listenerHello ! I tried using the `Events.ChatInputCommandError` listener to catch any errors thrown by the Multiple Clients on one file/instanceI was wondering if its possible to run multiple clients on one file (i.e. .forEach()-ing `new ClientHow to present Slashcommands?How can I present the Slashcommands of my bot in his About Me like for example carl.gg does?Interaction HandlersAm I required to specify to sapphire where my interaction handlers directory is? A `interaction-handbot won't get on and connect to discord.hi, my bot won't turn on. i've coded a lot of bots before with sapphire and they worked just fine, d