More rework progress, remove all eris imports

This commit is contained in:
Dark 2021-06-01 02:05:55 +02:00
parent 8f7a6510eb
commit 52839cc9f3
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
181 changed files with 352 additions and 343 deletions

View file

@ -14,7 +14,6 @@ import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
import { logger } from "../../../logger";
import moment from "moment-timezone";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { MessageContent } from "eris";
export async function getLogMessage(
pluginData: GuildPluginData<LogsPluginType>,

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { LogsPluginType, TLogChannelMap } from "../types";
import { LogType } from "../../../data/LogType";
import { TextChannel } from "eris";
import { createChunkedMessage, get, noop } from "../../../utils";
import { getLogMessage } from "./getLogMessage";
import { allowTimeout } from "../../../RegExpRunner";
@ -19,7 +19,7 @@ export async function log(pluginData: GuildPluginData<LogsPluginType>, type: Log
const typeStr = LogType[type];
logChannelLoop: for (const [channelId, opts] of Object.entries(logChannels)) {
const channel = pluginData.guild.channels.get(channelId);
const channel = pluginData.guild.channels.cache.get(channelId);
if (!channel || !(channel instanceof TextChannel)) continue;
if ((opts.include && opts.include.includes(typeStr)) || (opts.exclude && !opts.exclude.includes(typeStr))) {
@ -45,7 +45,7 @@ export async function log(pluginData: GuildPluginData<LogsPluginType>, type: Log
if (opts.excluded_roles) {
for (const value of Object.values(data || {})) {
if (value instanceof SavedMessage) {
const member = pluginData.guild.members.get(value.user_id);
const member = pluginData.guild.members.cache.get(value.user_id);
for (const role of member?.roles || []) {
if (opts.excluded_roles.includes(role)) {
continue logChannelLoop;

View file

@ -1,5 +1,5 @@
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { Attachment } from "eris";
import { useMediaUrls, stripObjectToScalars, resolveUser } from "../../../utils";
import { LogType } from "../../../data/LogType";
import moment from "moment-timezone";
@ -9,7 +9,7 @@ import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
const user = await resolveUser(pluginData.client, savedMessage.user_id);
const channel = pluginData.guild.channels.get(savedMessage.channel_id);
const channel = pluginData.guild.channels.cache.get(savedMessage.channel_id);
if (user) {
// Replace attachment URLs with media URLs

View file

@ -5,7 +5,7 @@ import { LogType } from "../../../data/LogType";
import { getBaseUrl } from "../../../pluginUtils";
export async function onMessageDeleteBulk(pluginData: GuildPluginData<LogsPluginType>, savedMessages: SavedMessage[]) {
const channel = pluginData.guild.channels.get(savedMessages[0].channel_id);
const channel = pluginData.guild.channels.cache.get(savedMessages[0].channel_id);
const archiveId = await pluginData.state.archives.createFromSavedMessages(savedMessages, pluginData.guild);
const archiveUrl = pluginData.state.archives.getUrl(getBaseUrl(pluginData), archiveId);
const authorIds = Array.from(new Set(savedMessages.map(item => `\`${item.user_id}\``))).join(", ");

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { LogsPluginType } from "../types";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { Embed } from "eris";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars, resolveUser } from "../../../utils";
import cloneDeep from "lodash.clonedeep";
@ -47,7 +47,7 @@ export async function onMessageUpdate(
}
const user = await resolveUser(pluginData.client, savedMessage.user_id);
const channel = pluginData.guild.channels.get(savedMessage.channel_id);
const channel = pluginData.guild.channels.cache.get(savedMessage.channel_id);
pluginData.state.guildLogs.log(LogType.MESSAGE_EDIT, {
user: stripObjectToScalars(user),