Update to new Knub 30 beta. Code clean-up.
This commit is contained in:
parent
5d579446c5
commit
2f470dc37a
299 changed files with 1075 additions and 1004 deletions
|
@ -1,6 +1,6 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType, TLogFormats } from "../types";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import {
|
||||
verboseUserMention,
|
||||
verboseUserName,
|
||||
|
@ -8,15 +8,15 @@ import {
|
|||
messageSummary,
|
||||
resolveMember,
|
||||
renderRecursively,
|
||||
} from "src/utils";
|
||||
import { SavedMessage } from "src/data/entities/SavedMessage";
|
||||
import { renderTemplate, TemplateParseError } from "src/templateFormatter";
|
||||
import { logger } from "src/logger";
|
||||
} from "../../../utils";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
|
||||
import { logger } from "../../../logger";
|
||||
import moment from "moment-timezone";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
|
||||
export async function getLogMessage(
|
||||
pluginData: PluginData<LogsPluginType>,
|
||||
pluginData: GuildPluginData<LogsPluginType>,
|
||||
type: LogType,
|
||||
data: any,
|
||||
formats?: TLogFormats,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType, TLogChannelMap } from "../types";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { TextChannel } from "eris";
|
||||
import { createChunkedMessage, noop } from "src/utils";
|
||||
import { createChunkedMessage, noop } from "../../../utils";
|
||||
import { getLogMessage } from "./getLogMessage";
|
||||
import { allowTimeout } from "../../../RegExpRunner";
|
||||
|
||||
const excludedUserProps = ["user", "member", "mod"];
|
||||
|
||||
export async function log(pluginData: PluginData<LogsPluginType>, type: LogType, data: any) {
|
||||
export async function log(pluginData: GuildPluginData<LogsPluginType>, type: LogType, data: any) {
|
||||
const logChannels: TLogChannelMap = pluginData.config.get().channels;
|
||||
const typeStr = LogType[type];
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { SavedMessage } from "src/data/entities/SavedMessage";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { Attachment } from "eris";
|
||||
import { useMediaUrls, stripObjectToScalars, resolveUser } from "src/utils";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { useMediaUrls, stripObjectToScalars, resolveUser } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import moment from "moment-timezone";
|
||||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
|
||||
export async function onMessageDelete(pluginData: PluginData<LogsPluginType>, savedMessage: SavedMessage) {
|
||||
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);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { SavedMessage } from "src/data/entities/SavedMessage";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { getBaseUrl } from "src/pluginUtils";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { getBaseUrl } from "../../../pluginUtils";
|
||||
|
||||
export async function onMessageDeleteBulk(pluginData: PluginData<LogsPluginType>, savedMessages: SavedMessage[]) {
|
||||
export async function onMessageDeleteBulk(pluginData: GuildPluginData<LogsPluginType>, savedMessages: SavedMessage[]) {
|
||||
const channel = pluginData.guild.channels.get(savedMessages[0].channel_id);
|
||||
const archiveId = await pluginData.state.archives.createFromSavedMessages(savedMessages, pluginData.guild);
|
||||
const archiveUrl = pluginData.state.archives.getUrl(getBaseUrl(pluginData), archiveId);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { SavedMessage } from "src/data/entities/SavedMessage";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { Embed } from "eris";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { stripObjectToScalars, resolveUser } from "src/utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars, resolveUser } from "../../../utils";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
|
||||
export async function onMessageUpdate(
|
||||
pluginData: PluginData<LogsPluginType>,
|
||||
pluginData: GuildPluginData<LogsPluginType>,
|
||||
savedMessage: SavedMessage,
|
||||
oldSavedMessage: SavedMessage,
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue