message commands are not working
trying to update to v4 and the bot is not recognizing commands. i have enabled
loadMessageCommandListeners: true
and the bot does have proper intents. is there anything new i should be updating?Solution:Jump to solution
Possibly related to https://discord.com/channels/737141877803057244/1062989204549816320/1062989204549816320
please use search before making a new post....
25 Replies
Solution
Possibly related to https://discord.com/channels/737141877803057244/1062989204549816320/1062989204549816320
please use search before making a new post.
actually i tried a lot and couldnt find this
thanks tho
Don't take this in a negative way but I call this into question because simply searching "message" has it show up. Maybe you're not aware you can filter/search forum posts? Video shows how on mobile, desktop is pretty much the same.
Not to mention the thread was high up still. You just had to scroll down a fractional bit.
With both these factors there is just no way you put in, by your own claim, a lot of effort.
@sairasu so the linked post was resolved, but commands did work there to begin with. If you still need help please provide the code of your bot as without code we can't do much
- Did you use a folder of the examples repository or did you use the CLI to generate your bot?
- What's your file/folder structure?
- What's your "main" property in
package.json
- Are you using TypeScript? And if so, how are you compiling and running your code?
- Are you using the version 2 or version 3 of @sapphire/framework
?
- In case you are using version 3 of @sapphire/framework
, and your problem related to message commands, did you add loadMessageCommandListeners
to your SapphireClient
options
Remember that if you are new to @sapphire/framework
it is important that you read the user guide.I was using control F but yea for sure
I thought I had fixed it but it did not actually work which is strange
the bot responds when it’s pinged and says “My prefix is .” but doesn’t respond to commands
I’ll send something in a few
the only issue is that messageCreate IS being logged if i try and just make it log what im saying in a server
but commands just dont run? its hard to find the bug when theres no error
heres what i have in my index
Other than the 10 seconds cooldown after 2 commands there's nothing wrong there. Please share the full code so I or anyone else can properly debug, or attach a debugger yourself and use breakpoints to navigate the core events.
absolutely no reason to use the same command more than twice but ok
not sure how thats relevant
ill debug ig
depends on what kind of bot you're making tbh. For example for @Dragonite you may want to get the details on multiple pokemon so you query twice
for sure
not in my case
anyway if you want my help zip up the code or put it on GH (private and give me access if you must)
I seem to have fallen into the same issue as well, I can't figure out why after I've updated to v4 that message commands won't run, and it worked on v3. I have tried to check and for some reason it won't run anything inside
messageRun
.Same goes for you, we'll need some code if you want help. We cannot wave a magic wand and read your brain and look through your eyes.
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stacktraces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions is this, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson) ❯ How to ask questions the smart way (Raymond)
Sorry, I thought as it said it was solved that it may have been fixed in DMs or something. Here is the repo, ignore the bit of a mess it is, ik I need to get to refactoring it 😭 https://github.com/veganhacktivists/arabot
This is a command I knew that worked in v3: https://github.com/veganhacktivists/arabot/blob/main/src/commands/roles/convinced.ts
In https://github.com/veganhacktivists/arabot/blob/main/src/index.ts I have also tried to see if
defaultPrefix: process.env.DEFAULT_PREFIX,
was the issue and replaced it with defaultPrefix: '?',
in testing, but it didn't help.You didn't provide
GatewayIntentBits.MessageContent
, and possibly also not enable the message content intent on https://discord.dev dashboardDiscord 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.
Yeahhh it seems like I didn't know I had to add
GatewayIntentBits.MessageContent
, sorry about that. Thank you though :))An easy mistake to make
(made it myself as well a few days ago)
to be fair it's also not documented in the djs migration guide <_<
Could you maybe make a PR to https://github.com/sapphiredev/website/blob/main/docs/Guide/getting-started/updating-from-v3-to-v4.mdx to add it? That would help a lot
Ahhh alright, at least that softens the blow for me haha
And I'd be happy to make a PR :)
awesome, thanks
Same issue here I added cooldowns and message commands stopped working
same reply here- please include additional context or make a new post
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stacktraces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions is this, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson) ❯ How to ask questions the smart way (Raymond)