3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 20:35:02 +00:00

Type fixes for djs

This commit is contained in:
Dark 2021-06-30 04:56:56 +02:00
parent 653d6c1dc2
commit 0822fc15e5
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
130 changed files with 8877 additions and 411 deletions

View file

@ -1,4 +1,4 @@
import { TextChannel } from "discord.js";
import { Snowflake, TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { CaseTypes } from "../../../data/CaseTypes";
@ -123,7 +123,9 @@ export async function logAndDetectMessageSpam(
// Then, if enabled, remove the spam messages
if (spamConfig.clean !== false) {
msgIds.forEach(id => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
(pluginData.guild.channels.cache.get(savedMessage.channel_id)! as TextChannel).bulkDelete(msgIds).catch(noop);
(pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake)! as TextChannel)
.bulkDelete(msgIds as Snowflake[])
.catch(noop);
}
// Store the ID of the last handled message
@ -146,7 +148,7 @@ export async function logAndDetectMessageSpam(
clearRecentUserActions(pluginData, type, savedMessage.user_id, savedMessage.channel_id);
// Generate a log from the detected messages
const channel = pluginData.guild.channels.cache.get(savedMessage.channel_id);
const channel = pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake);
const archiveUrl = await saveSpamArchives(pluginData, uniqueMessages);
// Create a case

View file

@ -1,10 +1,11 @@
import { Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { RecentActionType, SpamPluginType } from "../types";
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
export async function logCensor(pluginData: GuildPluginData<SpamPluginType>, savedMessage: SavedMessage) {
const member = pluginData.guild.members.cache.get(savedMessage.user_id);
const member = pluginData.guild.members.cache.get(savedMessage.user_id as Snowflake);
const config = await pluginData.config.getMatchingConfig({
userId: savedMessage.user_id,
channelId: savedMessage.channel_id,

View file

@ -1,3 +1,4 @@
import { Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
@ -7,7 +8,7 @@ import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
export async function onMessageCreate(pluginData: GuildPluginData<SpamPluginType>, savedMessage: SavedMessage) {
if (savedMessage.is_bot) return;
const member = pluginData.guild.members.cache.get(savedMessage.user_id);
const member = pluginData.guild.members.cache.get(savedMessage.user_id as Snowflake);
const config = await pluginData.config.getMatchingConfig({
userId: savedMessage.user_id,
channelId: savedMessage.channel_id,