[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•15mo ago
The problem is with the webhookEmbed, since the DM is sent without problems
UndiedGFX
UndiedGFX•15mo ago
where are you emitting the event?
Solution
UndiedGFX
UndiedGFX•15mo 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•15mo 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•15mo 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•15mo ago
@🠷Carlos👑
-Carlos👑
-Carlos👑OP•15mo ago
^ logged both functions, both were defined
UndiedGFX
UndiedGFX•15mo ago
so both give a return value for that test "data"? was this the line 507?
-Carlos👑
-Carlos👑OP•15mo ago
yes for both questions
UndiedGFX
UndiedGFX•15mo 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•15mo ago
basically on my messageCreate event I have the automod listener emit
UndiedGFX
UndiedGFX•15mo 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•15mo ago
I meant this, this is my messageCreate event . and in the automod listener I use the automodPunish function wait hold up
UndiedGFX
UndiedGFX•15mo ago
well well now i hope you understand where it went wrong
-Carlos👑
-Carlos👑OP•15mo ago
nvm it was not it I was confused for a second Issue was fixed btw
UndiedGFX
UndiedGFX•15mo ago
mark this as solved with whatever message helped you solve it
-Carlos👑
-Carlos👑OP•15mo ago
it was answered in the djs server
UndiedGFX
UndiedGFX•15mo ago
looking at djs server, the one I diagnosed was right @Favna please mark this as solution

Did you find this page helpful?