Add some safeguards against messages without an author
This commit is contained in:
parent
c4523ddc32
commit
27d525c155
2 changed files with 3 additions and 2 deletions
|
@ -63,7 +63,7 @@ export class CensorPlugin extends Plugin {
|
|||
}
|
||||
|
||||
async applyFiltersToMsg(msg: Message) {
|
||||
if (msg.author.bot) return;
|
||||
if (!msg.author || msg.author.bot) return;
|
||||
if (msg.type !== 0) return;
|
||||
if (!msg.content) return;
|
||||
|
||||
|
|
|
@ -235,13 +235,14 @@ export class LogsPlugin extends Plugin {
|
|||
|
||||
@d.event("messageUpdate")
|
||||
onMessageUpdate(msg: Message, oldMsg: Message) {
|
||||
if (!msg.author) return;
|
||||
if (oldMsg && msg.content === oldMsg.content) return;
|
||||
if (msg.type !== 0) return;
|
||||
|
||||
this.serverLogs.log(LogType.MESSAGE_EDIT, {
|
||||
member: stripObjectToScalars(msg.member, ["user"]),
|
||||
channel: stripObjectToScalars(msg.channel),
|
||||
before: oldMsg ? (oldMsg.cleanContent || oldMsg.content || "") : "Unavailable due to restart",
|
||||
before: oldMsg ? oldMsg.cleanContent || oldMsg.content || "" : "Unavailable due to restart",
|
||||
after: msg.cleanContent || msg.content || ""
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue