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