Fix error in onMessageDelete logs
This commit is contained in:
parent
a26eaa480c
commit
3e7313d40f
1 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { BaseGuildTextChannel, Snowflake, ThreadChannel } from "discord.js";
|
import { Snowflake, TextChannel, ThreadChannel } from "discord.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
|
@ -10,9 +10,14 @@ import { logMessageDeleteBare } from "../logFunctions/logMessageDeleteBare";
|
||||||
|
|
||||||
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
|
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
|
||||||
const user = await resolveUser(pluginData.client, savedMessage.user_id);
|
const user = await resolveUser(pluginData.client, savedMessage.user_id);
|
||||||
const channel = pluginData.guild.channels.resolve(savedMessage.channel_id as Snowflake)! as
|
const channel = pluginData.guild.channels.resolve(savedMessage.channel_id as Snowflake) as
|
||||||
| BaseGuildTextChannel
|
| TextChannel
|
||||||
| ThreadChannel;
|
| ThreadChannel
|
||||||
|
| null;
|
||||||
|
|
||||||
|
if (channel == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isLogIgnored(pluginData, LogType.MESSAGE_DELETE, savedMessage.id)) {
|
if (isLogIgnored(pluginData, LogType.MESSAGE_DELETE, savedMessage.id)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue