MessageCreate listener not working as expected
https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/tree/2f7644c2d0d9ebc75ff11ef27f7cc70a33476b70/src/baseBot/listeners/AutoResponse
I have some listeners inside this folder, their primary job is to respond to trigger texts (for eg sending
FBI
word in any text channel will send a random FBI gif in that channel)
But for some reason none of them are working.
The weird part is that I have message reactions too:
https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/blob/2f7644c2d0d9ebc75ff11ef27f7cc70a33476b70/src/baseBot/listeners/MessageReactions.ts
And these message reactions work flawlessly.
I even moved FBI.ts autoresponse into the parent directory and it still doesn't work.
(Please refer to the repo to see the directory structure)
Even after enabling partials, FBI.ts doesn't work, but MessageReactions.ts does work.
I checked bot permissions & I set Send messages
& Send messages in thread
both to true in bot role settings. And still the same result.
Any solutions?GitHub
Perpetual-Mechanical-Array-Bot/src/baseBot/listeners/AutoResponse a...
Discord Bot for Traveler Mains Server. Contribute to MRDGH2821/Perpetual-Mechanical-Array-Bot development by creating an account on GitHub.
GitHub
Perpetual-Mechanical-Array-Bot/MessageReactions.ts at 2f7644c2d0d9e...
Discord Bot for Traveler Mains Server. Contribute to MRDGH2821/Perpetual-Mechanical-Array-Bot development by creating an account on GitHub.
12 Replies
I updated all dependencies and still there's the problem of one listener working & others not
@Helpers please help!
Apologies for disturbing peace 🙏
do you have the intent enabled in the dev portal?
presence intent on
server members intent on
Message content intent on
you override onLoad
thats the reason
If you override onLoad, you should also call super
I removed it, I brought
FBI.ts
into parent folder
Didn't workdid you recompile?
also did you delete the whole
public onLoad
or... just its content?Removed the whole thing, I
git push
-ed so you can see the latest change
Deleted the dist folder & compiled again
Still samewhat branch
GitHub
Perpetual-Mechanical-Array-Bot/src/baseBot/listeners/AutoResponse a...
Discord Bot for Traveler Mains Server. Contribute to MRDGH2821/Perpetual-Mechanical-Array-Bot development by creating an account on GitHub.
o btw
your event is wrong in so many ways
your code expects a discord.js message, yet you use...raw data
so no wonder it doesn't work
You should set event to Events.MessageCreate, remove emitter
Adding to this, raw data because the emitter is set to ws. The websocket emits the raw data.
I see thanks a lot!
At one point of time in past, the same code somehow wasn't working (in TS v4.5 days)
So I did that many changes
Fortunately reverting back seems to help
Solution:
1. Call
super()
if overriding onLoad()
or completely remove it
2. Use Events
enum, not GatewayDispatchEvents
enum
3. Remove emitter field if you want to use the default one
4. Update dependencies & compile from scratch