[ERROR] Encountered error on event listener "moderationLog"

Solution:
moreover, looking at the error stack at ModerationLogListener.run (C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\listeners\moderationLog.js:19:8) the error appears here, maybe your getPunishmentTitle or getAutomodPunishmentTitle is returning null/undefined instead of a string, better fix that...
No description
Jump to solution
18 Replies
-Carlos👑
-Carlos👑OP•2y ago
The problem is with the webhookEmbed, since the DM is sent without problems
UndiedGFX
UndiedGFX•2y ago
where are you emitting the event?
Solution
UndiedGFX
UndiedGFX•2y ago
moreover, looking at the error stack at ModerationLogListener.run (C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\listeners\moderationLog.js:19:8) the error appears here, maybe your getPunishmentTitle or getAutomodPunishmentTitle is returning null/undefined instead of a string, better fix that
No description
UndiedGFX
UndiedGFX•2y ago
and the other error appears at at Object.automodBan (C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\utils.js:507:27) (i have no idea what is that 507th line and what you are doing here but that much pretty much explain why you are encountering errors)
-Carlos👑
-Carlos👑OP•2y ago
inside the automodBan function return container.client.emit("moderationLog", data, false); the problem is with the webhook embed, also this only happends if automodBan is triggered
UndiedGFX
UndiedGFX•2y ago
@🠷Carlos👑
-Carlos👑
-Carlos👑OP•2y ago
^ logged both functions, both were defined
UndiedGFX
UndiedGFX•2y ago
so both give a return value for that test "data"? was this the line 507?
-Carlos👑
-Carlos👑OP•2y ago
yes for both questions
UndiedGFX
UndiedGFX•2y ago
my question is, where do you use the automodBan, if you are assigning a value to it later on, remove the return before the emit
-Carlos👑
-Carlos👑OP•2y ago
basically on my messageCreate event I have the automod listener emit
UndiedGFX
UndiedGFX•2y ago
makes no sence because where would you get that "data" inside your messageCreate which automodBan gives you @🠷Carlos👑 and yes, if possible i want to know how you are invoking the automod listener event inside messageCreate
-Carlos👑
-Carlos👑OP•2y ago
I meant this, this is my messageCreate event . and in the automod listener I use the automodPunish function wait hold up
UndiedGFX
UndiedGFX•2y ago
well well now i hope you understand where it went wrong
-Carlos👑
-Carlos👑OP•2y ago
nvm it was not it I was confused for a second Issue was fixed btw
UndiedGFX
UndiedGFX•2y ago
mark this as solved with whatever message helped you solve it
-Carlos👑
-Carlos👑OP•2y ago
it was answered in the djs server
UndiedGFX
UndiedGFX•2y ago
looking at djs server, the one I diagnosed was right @Favna please mark this as solution

Did you find this page helpful?