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

remove unused imports & add prettier plugin

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-20 20:13:30 +00:00 committed by GitHub
parent 33c6ae2188
commit 59bf98f928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
289 changed files with 861 additions and 834 deletions

View file

@ -8,8 +8,8 @@ import { ApiLogins } from "../data/ApiLogins";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
import { ApiUserInfo } from "../data/ApiUserInfo";
import { ApiUserInfoData } from "../data/entities/ApiUserInfo";
import { ok } from "./responses";
import { env } from "../env";
import { ok } from "./responses";
interface IPassportApiUser {
apiKey: string;

View file

@ -1,20 +1,20 @@
import { ApiPermissions } from "@shared/apiPermissions";
import express, { Request, Response } from "express";
import { YAMLException } from "js-yaml";
import moment from "moment-timezone";
import { validateGuildConfig } from "../configValidator";
import { AllowedGuilds } from "../data/AllowedGuilds";
import { ApiAuditLog } from "../data/ApiAuditLog";
import { AuditLogEventTypes } from "../data/apiAuditLogTypes";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../data/ApiPermissionAssignments";
import { Configs } from "../data/Configs";
import { Queue } from "../Queue";
import { isSnowflake } from "../utils";
import { loadYamlSafely } from "../utils/loadYamlSafely";
import { ObjectAliasError } from "../utils/validateNoObjectAliases";
import { apiTokenAuthHandlers } from "./auth";
import { hasGuildPermission, requireGuildPermission } from "./permissions";
import { clientError, ok, serverError, unauthorized } from "./responses";
import { loadYamlSafely } from "../utils/loadYamlSafely";
import { ObjectAliasError } from "../utils/validateNoObjectAliases";
import { isSnowflake } from "../utils";
import moment from "moment-timezone";
import { ApiAuditLog } from "../data/ApiAuditLog";
import { AuditLogEventTypes } from "../data/apiAuditLogTypes";
import { Queue } from "../Queue";
const apiPermissionAssignments = new ApiPermissionAssignments();
const auditLog = new ApiAuditLog();

View file

@ -1,13 +1,13 @@
import { ApiPermissions } from "@shared/apiPermissions";
import express, { Request, Response } from "express";
import { requireGuildPermission } from "../permissions";
import { clientError, ok } from "../responses";
import { GuildCases } from "../../data/GuildCases";
import moment from "moment-timezone";
import { z } from "zod";
import { Case } from "../../data/entities/Case";
import { rateLimit } from "../rateLimits";
import { GuildCases } from "../../data/GuildCases";
import { MINUTES } from "../../utils";
import moment from "moment-timezone";
import { requireGuildPermission } from "../permissions";
import { rateLimit } from "../rateLimits";
import { clientError, ok } from "../responses";
const caseHandlingModeSchema = z.union([
z.literal("replace"),

View file

@ -1,7 +1,7 @@
import express from "express";
import { apiTokenAuthHandlers } from "../auth";
import { initGuildsMiscAPI } from "./misc";
import { initGuildsImportExportAPI } from "./importExport";
import { initGuildsMiscAPI } from "./misc";
export function initGuildsAPI(app: express.Express) {
const guildRouter = express.Router();

View file

@ -1,19 +1,19 @@
import { ApiPermissions } from "@shared/apiPermissions";
import express, { Request, Response } from "express";
import { YAMLException } from "js-yaml";
import moment from "moment-timezone";
import { validateGuildConfig } from "../../configValidator";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";
import { hasGuildPermission, requireGuildPermission } from "../permissions";
import { clientError, ok, serverError, unauthorized } from "../responses";
import { loadYamlSafely } from "../../utils/loadYamlSafely";
import { ObjectAliasError } from "../../utils/validateNoObjectAliases";
import { isSnowflake } from "../../utils";
import moment from "moment-timezone";
import { ApiAuditLog } from "../../data/ApiAuditLog";
import { AuditLogEventTypes } from "../../data/apiAuditLogTypes";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";
import { Queue } from "../../Queue";
import { isSnowflake } from "../../utils";
import { loadYamlSafely } from "../../utils/loadYamlSafely";
import { ObjectAliasError } from "../../utils/validateNoObjectAliases";
import { hasGuildPermission, requireGuildPermission } from "../permissions";
import { clientError, ok, serverError, unauthorized } from "../responses";
const apiPermissionAssignments = new ApiPermissionAssignments();
const auditLog = new ApiAuditLog();

View file

@ -1,6 +1,6 @@
import { connect } from "../data/db";
import { setIsAPI } from "../globals";
import { env } from "../env";
import { setIsAPI } from "../globals";
if (!env.KEY) {
// tslint:disable-next-line:no-console

View file

@ -1,14 +1,14 @@
import cors from "cors";
import express from "express";
import multer from "multer";
import { TokenError } from "passport-oauth2";
import { env } from "../env";
import { initArchives } from "./archives";
import { initAuth } from "./auth";
import { initDocs } from "./docs";
import { initGuildsAPI } from "./guilds/index";
import { clientError, error, notFound } from "./responses";
import { startBackgroundTasks } from "./tasks";
import multer from "multer";
import { env } from "../env";
const app = express();

View file

@ -1,16 +1,16 @@
import {
GuildChannel,
GuildMember,
Snowflake,
User,
GuildTextBasedChannel,
escapeCodeBlock,
escapeInlineCode,
GuildChannel,
GuildMember,
GuildTextBasedChannel,
Snowflake,
User,
} from "discord.js";
import {
baseCommandParameterTypeHelpers,
messageCommandBaseTypeConverters,
CommandContext,
messageCommandBaseTypeConverters,
TypeConversionError,
} from "knub";
import { createTypeHelper } from "knub-command-manager";

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
import { BaseRepository } from "./BaseRepository";
import { AllowedGuild } from "./entities/AllowedGuild";
import moment from "moment-timezone";
import { DBDateFormat } from "../utils";
export class AllowedGuilds extends BaseRepository {
private allowedGuilds: Repository<AllowedGuild>;

View file

@ -1,7 +1,7 @@
import { BaseRepository } from "./BaseRepository";
import { getRepository, Repository } from "typeorm/index";
import { ApiAuditLogEntry } from "./entities/ApiAuditLogEntry";
import { AuditLogEventData, AuditLogEventType } from "./apiAuditLogTypes";
import { BaseRepository } from "./BaseRepository";
import { ApiAuditLogEntry } from "./entities/ApiAuditLogEntry";
export class ApiAuditLog extends BaseRepository {
private auditLog: Repository<ApiAuditLogEntry<any>>;

View file

@ -1,9 +1,9 @@
import { ApiPermissions } from "@shared/apiPermissions";
import { getRepository, Repository } from "typeorm";
import { BaseRepository } from "./BaseRepository";
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment";
import { ApiAuditLog } from "./ApiAuditLog";
import { AuditLogEventTypes } from "./apiAuditLogTypes";
import { BaseRepository } from "./BaseRepository";
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment";
export enum ApiPermissionTypes {
User = "USER",

View file

@ -1,6 +1,6 @@
import { getRepository, Repository } from "typeorm";
import { ArchiveEntry } from "./entities/ArchiveEntry";
import { BaseRepository } from "./BaseRepository";
import { ArchiveEntry } from "./entities/ArchiveEntry";
export class Archives extends BaseRepository {
protected archives: Repository<ArchiveEntry>;

View file

@ -4,11 +4,11 @@ import { isDefaultSticker } from "src/utils/isDefaultSticker";
import { getRepository, Repository } from "typeorm";
import { renderTemplate, TemplateSafeValueContainer } from "../templateFormatter";
import { trimLines } from "../utils";
import { decrypt, encrypt } from "../utils/crypt";
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ArchiveEntry } from "./entities/ArchiveEntry";
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects";
import { SavedMessage } from "./entities/SavedMessage";
import { decrypt, encrypt } from "../utils/crypt";
const DEFAULT_EXPIRY_DAYS = 30;

View file

@ -1,11 +1,11 @@
import { getRepository, In, InsertResult, Repository } from "typeorm";
import { Queue } from "../Queue";
import { chunkArray } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { CaseTypes } from "./CaseTypes";
import { connection } from "./db";
import { Case } from "./entities/Case";
import { CaseNote } from "./entities/CaseNote";
import { chunkArray } from "../utils";
import { Queue } from "../Queue";
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;

View file

@ -1,6 +1,6 @@
import { Mute } from "./entities/Mute";
import { ScheduledPost } from "./entities/ScheduledPost";
import { Reminder } from "./entities/Reminder";
import { ScheduledPost } from "./entities/ScheduledPost";
import { Tempban } from "./entities/Tempban";
import { VCAlert } from "./entities/VCAlert";

View file

@ -1,7 +1,7 @@
import { getRepository, Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { RoleQueueItem } from "./entities/RoleQueueItem";
import { connection } from "./db";
import { RoleQueueItem } from "./entities/RoleQueueItem";
export class GuildRoleQueue extends BaseGuildRepository {
private roleQueue: Repository<RoleQueueItem>;

View file

@ -2,12 +2,12 @@ import { GuildChannel, Message } from "discord.js";
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { QueuedEventEmitter } from "../QueuedEventEmitter";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
import { buildEntity } from "./buildEntity";
import { noop } from "../utils";
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
import { asyncMap } from "../utils/async";
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { buildEntity } from "./buildEntity";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
export class GuildSavedMessages extends BaseGuildRepository<SavedMessage> {
private messages: Repository<SavedMessage>;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { Mute } from "./entities/Mute";
import { DAYS, DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { Mute } from "./entities/Mute";
const OLD_EXPIRED_MUTE_THRESHOLD = 7 * DAYS;

View file

@ -1,12 +1,12 @@
import { getRepository, Repository } from "typeorm";
import { PhishermanCacheEntry } from "./entities/PhishermanCacheEntry";
import { PhishermanDomainInfo, PhishermanUnknownDomain } from "./types/phisherman";
import fetch, { Headers } from "node-fetch";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
import moment from "moment-timezone";
import { PhishermanKeyCacheEntry } from "./entities/PhishermanKeyCacheEntry";
import crypto from "crypto";
import moment from "moment-timezone";
import fetch, { Headers } from "node-fetch";
import { getRepository, Repository } from "typeorm";
import { env } from "../env";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
import { PhishermanCacheEntry } from "./entities/PhishermanCacheEntry";
import { PhishermanKeyCacheEntry } from "./entities/PhishermanKeyCacheEntry";
import { PhishermanDomainInfo, PhishermanUnknownDomain } from "./types/phisherman";
const API_URL = "https://api.phisherman.gg";
const MASTER_API_KEY = env.PHISHERMAN_API_KEY;

View file

@ -1,8 +1,8 @@
import { getRepository, Repository } from "typeorm";
import { Reminder } from "./entities/Reminder";
import { BaseRepository } from "./BaseRepository";
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { Reminder } from "./entities/Reminder";
export class Reminders extends BaseRepository {
private reminders: Repository<Reminder>;

View file

@ -1,8 +1,8 @@
import { getRepository, Repository } from "typeorm";
import { ScheduledPost } from "./entities/ScheduledPost";
import { BaseRepository } from "./BaseRepository";
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { ScheduledPost } from "./entities/ScheduledPost";
export class ScheduledPosts extends BaseRepository {
private scheduledPosts: Repository<ScheduledPost>;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { Tempban } from "./entities/Tempban";
import { BaseRepository } from "./BaseRepository";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { Tempban } from "./entities/Tempban";
export class Tempbans extends BaseRepository {
private tempbans: Repository<Tempban>;

View file

@ -1,8 +1,8 @@
import { getRepository, Repository } from "typeorm";
import { VCAlert } from "./entities/VCAlert";
import { BaseRepository } from "./BaseRepository";
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { VCAlert } from "./entities/VCAlert";
export class VCAlerts extends BaseRepository {
private allAlerts: Repository<VCAlert>;

View file

@ -1,7 +1,7 @@
import { getRepository, Repository } from "typeorm";
import { Webhook } from "./entities/Webhook";
import { BaseRepository } from "./BaseRepository";
import { decrypt, encrypt } from "../utils/crypt";
import { BaseRepository } from "./BaseRepository";
import { Webhook } from "./entities/Webhook";
export class Webhooks extends BaseRepository {
repository: Repository<Webhook> = getRepository(Webhook);

View file

@ -1,8 +1,8 @@
import path from "path";
import { Connection, createConnection } from "typeorm";
import { backendDir } from "../paths";
import { SimpleError } from "../SimpleError";
import { QueryLogger } from "./queryLogger";
import path from "path";
import { backendDir } from "../paths";
const ormconfigPath = path.join(backendDir, "ormconfig.js");
const connectionOptions = require(ormconfigPath);

View file

@ -1,6 +1,6 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { ApiUserInfo } from "./ApiUserInfo";
import { ApiPermissionTypes } from "../ApiPermissionAssignments";
import { ApiUserInfo } from "./ApiUserInfo";
@Entity("api_permissions")
export class ApiPermissionAssignment {

View file

@ -2,7 +2,7 @@ import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
export const TRIGGER_COMPARISON_OPS = ["=", "!=", ">", "<", ">=", "<="] as const;
export type TriggerComparisonOp = typeof TRIGGER_COMPARISON_OPS[number];
export type TriggerComparisonOp = (typeof TRIGGER_COMPARISON_OPS)[number];
const REVERSE_OPS: Record<TriggerComparisonOp, TriggerComparisonOp> = {
"=": "!=",

View file

@ -1,11 +1,11 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import { Mutes } from "../Mutes";
import Timeout = NodeJS.Timeout;
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { Mute } from "../entities/Mute";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Mutes } from "../Mutes";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;
const MAX_TRIES_PER_SERVER = 3;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { Tempban } from "../entities/Tempban";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Tempbans } from "../Tempbans";
import { Tempban } from "../entities/Tempban";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,11 +1,11 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import moment from "moment-timezone";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import Timeout = NodeJS.Timeout;
import { VCAlerts } from "../VCAlerts";
import { lazyMemoize, MINUTES } from "../../utils";
import { VCAlert } from "../entities/VCAlert";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { VCAlerts } from "../VCAlerts";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;
const MAX_TRIES_PER_SERVER = 3;

View file

@ -1,9 +1,9 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import moment from "moment-timezone";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { lazyMemoize, MINUTES } from "../../utils";
import { Reminder } from "../entities/Reminder";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Reminders } from "../Reminders";
import Timeout = NodeJS.Timeout;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { ScheduledPost } from "../entities/ScheduledPost";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { ScheduledPosts } from "../ScheduledPosts";
import { ScheduledPost } from "../entities/ScheduledPost";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,5 +1,5 @@
import { AdvancedConsoleLogger } from "typeorm/logger/AdvancedConsoleLogger";
import type { QueryRunner } from "typeorm";
import { AdvancedConsoleLogger } from "typeorm/logger/AdvancedConsoleLogger";
let groupedQueryStats: Map<string, number> = new Map();

View file

@ -1,8 +1,8 @@
import path from "path";
import fs from "fs";
import dotenv from "dotenv";
import { rootDir } from "./paths";
import fs from "fs";
import path from "path";
import { z } from "zod";
import { rootDir } from "./paths";
const envType = z.object({
KEY: z.string().length(32),

View file

@ -15,39 +15,38 @@ import { Knub, PluginError } from "knub";
import { PluginLoadError } from "knub/dist/plugins/PluginLoadError";
// Always use UTC internally
// This is also enforced for the database in data/db.ts
import { EventEmitter } from "events";
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
import moment from "moment-timezone";
import { performance } from "perf_hooks";
import { AllowedGuilds } from "./data/AllowedGuilds";
import { Configs } from "./data/Configs";
import { connect } from "./data/db";
import { GuildLogs } from "./data/GuildLogs";
import { LogType } from "./data/LogType";
import { runExpiredArchiveDeletionLoop } from "./data/loops/expiredArchiveDeletionLoop";
import { runExpiringMutesLoop } from "./data/loops/expiringMutesLoop";
import { runExpiringTempbansLoop } from "./data/loops/expiringTempbansLoop";
import { runExpiringVCAlertsLoop } from "./data/loops/expiringVCAlertsLoop";
import { runPhishermanCacheCleanupLoop, runPhishermanReportingLoop } from "./data/loops/phishermanLoops";
import { runSavedMessageCleanupLoop } from "./data/loops/savedMessageCleanupLoop";
import { runUpcomingRemindersLoop } from "./data/loops/upcomingRemindersLoop";
import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPostsLoop";
import { hasPhishermanMasterAPIKey } from "./data/Phisherman";
import { consumeQueryStats } from "./data/queryLogger";
import { DiscordJSError } from "./DiscordJSError";
import { env } from "./env";
import { logger } from "./logger";
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
import { setProfiler } from "./profiler";
import { logRateLimit } from "./rateLimitStats";
import { RecoverablePluginError } from "./RecoverablePluginError";
import { SimpleError } from "./SimpleError";
import { startUptimeCounter } from "./uptime";
import { errorMessage, isDiscordAPIError, isDiscordHTTPError, MINUTES, SECONDS, sleep, successMessage } from "./utils";
import { loadYamlSafely } from "./utils/loadYamlSafely";
import { DecayingCounter } from "./utils/DecayingCounter";
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
import { logRateLimit } from "./rateLimitStats";
import { runExpiringMutesLoop } from "./data/loops/expiringMutesLoop";
import { runUpcomingRemindersLoop } from "./data/loops/upcomingRemindersLoop";
import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPostsLoop";
import { runExpiringTempbansLoop } from "./data/loops/expiringTempbansLoop";
import { runExpiringVCAlertsLoop } from "./data/loops/expiringVCAlertsLoop";
import { runExpiredArchiveDeletionLoop } from "./data/loops/expiredArchiveDeletionLoop";
import { runSavedMessageCleanupLoop } from "./data/loops/savedMessageCleanupLoop";
import { performance } from "perf_hooks";
import { setProfiler } from "./profiler";
import { enableProfiling } from "./utils/easyProfiler";
import { runPhishermanCacheCleanupLoop, runPhishermanReportingLoop } from "./data/loops/phishermanLoops";
import { hasPhishermanMasterAPIKey } from "./data/Phisherman";
import { consumeQueryStats } from "./data/queryLogger";
import { EventEmitter } from "events";
import { env } from "./env";
import { ZeppelinGlobalConfig, ZeppelinGuildConfig } from "./types";
import { loadYamlSafely } from "./utils/loadYamlSafely";
// TODO: Remove this once fixed on upstream
declare module "knub/dist/helpers" {

View file

@ -10,11 +10,11 @@ import { ExtendedMatchParams } from "knub/dist/config/PluginConfigManager"; // T
import { AnyPluginData } from "knub/dist/plugins/PluginData";
import { logger } from "./logger";
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
import { isStaff } from "./staff";
import { TZeppelinKnub } from "./types";
import { deepKeyIntersect, errorMessage, successMessage, tDeepPartial, tNullable } from "./utils";
import { Tail } from "./utils/typeUtils";
import { decodeAndValidateStrict, StrictValidationError, validate } from "./validatorUtils";
import { isStaff } from "./staff";
const { getMemberLevel } = helpers;

View file

@ -1,9 +1,9 @@
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { convertDelayStringToMS, resolveMember } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { AutoDeletePluginType, MAX_DELAY } from "../types";
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue";
import { LogsPlugin } from "../../Logs/LogsPlugin";
export async function onMessageCreate(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
const member = await resolveMember(pluginData.client, pluginData.guild, msg.user_id);

View file

@ -1,11 +1,11 @@
import { GuildTextBasedChannel, PermissionsBitField } from "discord.js";
import { AutoReaction } from "../../../data/entities/AutoReaction";
import { isDiscordAPIError } from "../../../utils";
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
import { missingPermissionError } from "../../../utils/missingPermissionError";
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { autoReactionsEvt } from "../types";
import { AutoReaction } from "../../../data/entities/AutoReaction";
const p = PermissionsBitField.Flags;

View file

@ -1,9 +1,9 @@
import * as t from "io-ts";
import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { BasePluginType, guildPluginEventListener, guildPluginMessageCommand } from "knub";
import { AutoReaction } from "../../data/entities/AutoReaction";
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { AutoReaction } from "../../data/entities/AutoReaction";
export const ConfigSchema = t.type({
can_manage: t.boolean,

View file

@ -10,9 +10,11 @@ import { registerEventListenersFromMap } from "../../utils/registerEventListener
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
import { StrictValidationError } from "../../validatorUtils";
import { CountersPlugin } from "../Counters/CountersPlugin";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin";
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin";
import { MutesPlugin } from "../Mutes/MutesPlugin";
import { PhishermanPlugin } from "../Phisherman/PhishermanPlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { availableActions } from "./actions/availableActions";
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
@ -34,8 +36,6 @@ import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
import { pluginInfo } from "./info";
import { availableTriggers } from "./triggers/availableTriggers";
import { AutomodPluginType, ConfigSchema } from "./types";
import { PhishermanPlugin } from "../Phisherman/PhishermanPlugin";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
const defaultOptions = {
config: {

View file

@ -1,7 +1,7 @@
import * as t from "io-ts";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { automodAction } from "../helpers";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const AddToCounterAction = automodAction({
configType: t.type({

View file

@ -9,19 +9,19 @@ import {
TemplateSafeValueContainer,
} from "../../../templateFormatter";
import {
chunkMessageLines,
isTruthy,
messageLink,
tAllowedMentions,
tNormalizedNullOptional,
isTruthy,
verboseChannelMention,
validateAndParseMessageContent,
chunkMessageLines,
verboseChannelMention,
} from "../../../utils";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin";
export const AlertAction = automodAction({
configType: t.type({

View file

@ -1,14 +1,14 @@
import { PermissionsBitField, PermissionsString } from "discord.js";
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { tNullable, isValidSnowflake, tPartialDictionary } from "../../../utils";
import { noop } from "knub/dist/utils";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import { isValidSnowflake, tNullable, tPartialDictionary } from "../../../utils";
import {
guildToTemplateSafeGuild,
savedMessageToTemplateSafeSavedMessage,
userToTemplateSafeUser,
} from "../../../utils/templateSafeObjects";
import { automodAction } from "../helpers";
export const ChangePermsAction = automodAction({
configType: t.type({

View file

@ -1,6 +1,5 @@
import { GuildTextBasedChannel, MessageCreateOptions, PermissionsBitField, Snowflake, User } from "discord.js";
import * as t from "io-ts";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import {
convertDelayStringToMS,
@ -14,10 +13,11 @@ import {
verboseChannelMention,
} from "../../../utils";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
import { AutomodContext } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
export const ReplyAction = automodAction({
configType: t.union([

View file

@ -1,7 +1,7 @@
import * as t from "io-ts";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { automodAction } from "../helpers";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const SetCounterAction = automodAction({
configType: t.type({

View file

@ -1,8 +1,8 @@
import { ChannelType, GuildTextBasedChannel, Snowflake } from "discord.js";
import * as t from "io-ts";
import { convertDelayStringToMS, isDiscordAPIError, tDelayString, tNullable } from "../../../utils";
import { automodAction } from "../helpers";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const SetSlowmodeAction = automodAction({
configType: t.type({

View file

@ -1,12 +1,12 @@
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { performance } from "perf_hooks";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { profilingEnabled } from "../../../utils/easyProfiler";
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
import { performance } from "perf_hooks";
import { profilingEnabled } from "../../../utils/easyProfiler";
export async function runAutomodOnMessage(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { startProfiling } from "../../../utils/easyProfiler";
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:clearOldRecentActions");

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { startProfiling } from "../../../utils/easyProfiler";
import { RECENT_SPAM_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function clearOldRecentSpam(pluginData: GuildPluginData<AutomodPluginType>) {
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:clearOldRecentSpam");

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
import { AutomodContext, AutomodPluginType } from "../types";
export function clearRecentActionsForMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
const stopProfiling = startProfiling(

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { startProfiling } from "../../../utils/easyProfiler";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function findRecentSpam(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,10 +1,10 @@
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { startProfiling } from "../../../utils/easyProfiler";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
import { getMatchingRecentActions } from "./getMatchingRecentActions";
import { startProfiling } from "../../../utils/easyProfiler";
export function getMatchingMessageRecentActions(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { startProfiling } from "../../../utils/easyProfiler";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function getMatchingRecentActions(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -2,8 +2,8 @@ import { ActivityType, Embed } from "discord.js";
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { resolveMember } from "../../../utils";
import { AutomodPluginType } from "../types";
import { DeepMutable } from "../../../utils/typeUtils.js";
import { AutomodPluginType } from "../types";
type TextTriggerWithMultipleMatchTypes = {
match_messages: boolean;

View file

@ -1,13 +1,13 @@
import { GuildTextBasedChannel, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { performance } from "perf_hooks";
import { calculateBlocking, profilingEnabled } from "../../../utils/easyProfiler";
import { availableActions } from "../actions/availableActions";
import { CleanAction } from "../actions/clean";
import { AutomodTriggerMatchResult } from "../helpers";
import { availableTriggers } from "../triggers/availableTriggers";
import { AutomodContext, AutomodPluginType } from "../types";
import { checkAndUpdateCooldown } from "./checkAndUpdateCooldown";
import { performance } from "perf_hooks";
import { calculateBlocking, profilingEnabled } from "../../../utils/easyProfiler";
export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
const userId = context.user?.id || context.member?.id || context.message?.user_id;

View file

@ -11,9 +11,9 @@ import { KickTrigger } from "./kick";
import { LineSpamTrigger } from "./lineSpam";
import { LinkSpamTrigger } from "./linkSpam";
import { MatchAttachmentTypeTrigger } from "./matchAttachmentType";
import { MatchMimeTypeTrigger } from "./matchMimeType";
import { MatchInvitesTrigger } from "./matchInvites";
import { MatchLinksTrigger } from "./matchLinks";
import { MatchMimeTypeTrigger } from "./matchMimeType";
import { MatchRegexTrigger } from "./matchRegex";
import { MatchWordsTrigger } from "./matchWords";
import { MemberJoinTrigger } from "./memberJoin";
@ -26,14 +26,14 @@ import { NoteTrigger } from "./note";
import { RoleAddedTrigger } from "./roleAdded";
import { RoleRemovedTrigger } from "./roleRemoved";
import { StickerSpamTrigger } from "./stickerSpam";
import { ThreadArchiveTrigger } from "./threadArchive";
import { ThreadCreateTrigger } from "./threadCreate";
import { ThreadCreateSpamTrigger } from "./threadCreateSpam";
import { ThreadDeleteTrigger } from "./threadDelete";
import { ThreadUnarchiveTrigger } from "./threadUnarchive";
import { UnbanTrigger } from "./unban";
import { UnmuteTrigger } from "./unmute";
import { WarnTrigger } from "./warn";
import { ThreadArchiveTrigger } from "./threadArchive";
import { ThreadUnarchiveTrigger } from "./threadUnarchive";
export const availableTriggers: Record<string, AutomodTriggerBlueprint<any, any>> = {
any_message: AnyMessageTrigger,

View file

@ -1,15 +1,15 @@
import { escapeInlineCode } from "discord.js";
import * as t from "io-ts";
import { phishermanDomainIsSafe } from "../../../data/Phisherman";
import { allowTimeout } from "../../../RegExpRunner";
import { getUrlsInString, tNullable } from "../../../utils";
import { mergeRegexes } from "../../../utils/mergeRegexes";
import { mergeWordsIntoRegex } from "../../../utils/mergeWordsIntoRegex";
import { TRegex } from "../../../validatorUtils";
import { PhishermanPlugin } from "../../Phisherman/PhishermanPlugin";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";
import { mergeRegexes } from "../../../utils/mergeRegexes";
import { mergeWordsIntoRegex } from "../../../utils/mergeWordsIntoRegex";
import { PhishermanPlugin } from "../../Phisherman/PhishermanPlugin";
import { phishermanDomainIsSafe } from "../../../data/Phisherman";
import { escapeInlineCode } from "discord.js";
interface MatchResultType {
type: MatchableTextType;

View file

@ -1,7 +1,7 @@
import { automodTrigger } from "../helpers";
import { escapeInlineCode } from "discord.js";
import * as t from "io-ts";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { escapeInlineCode } from "discord.js";
import { automodTrigger } from "../helpers";
interface MatchResultType {
matchedType: string;

View file

@ -1,12 +1,12 @@
import * as t from "io-ts";
import { allowTimeout } from "../../../RegExpRunner";
import { mergeRegexes } from "../../../utils/mergeRegexes";
import { normalizeText } from "../../../utils/normalizeText";
import { stripMarkdown } from "../../../utils/stripMarkdown";
import { TRegex } from "../../../validatorUtils";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";
import { mergeRegexes } from "../../../utils/mergeRegexes";
interface MatchResultType {
pattern: string;

View file

@ -7,22 +7,22 @@ import { sendSuccessMessage } from "../../pluginUtils";
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
import { getActiveReload, resetActiveReload } from "./activeReload";
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd";
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd";
import { AllowServerCmd } from "./commands/AllowServerCmd";
import { ChannelToServerCmd } from "./commands/ChannelToServerCmd";
import { DisallowServerCmd } from "./commands/DisallowServerCmd";
import { EligibleCmd } from "./commands/EligibleCmd";
import { LeaveServerCmd } from "./commands/LeaveServerCmd";
import { ListDashboardPermsCmd } from "./commands/ListDashboardPermsCmd";
import { ListDashboardUsersCmd } from "./commands/ListDashboardUsersCmd";
import { ProfilerDataCmd } from "./commands/ProfilerDataCmd";
import { RateLimitPerformanceCmd } from "./commands/RateLimitPerformanceCmd";
import { ReloadGlobalPluginsCmd } from "./commands/ReloadGlobalPluginsCmd";
import { ReloadServerCmd } from "./commands/ReloadServerCmd";
import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd";
import { RestPerformanceCmd } from "./commands/RestPerformanceCmd";
import { ServersCmd } from "./commands/ServersCmd";
import { BotControlPluginType, ConfigSchema } from "./types";
import { ProfilerDataCmd } from "./commands/ProfilerDataCmd";
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd";
import { ChannelToServerCmd } from "./commands/ChannelToServerCmd";
import { RestPerformanceCmd } from "./commands/RestPerformanceCmd";
import { RateLimitPerformanceCmd } from "./commands/RateLimitPerformanceCmd";
const defaultOptions = {
config: {

View file

@ -1,10 +1,10 @@
import { ApiPermissions } from "@shared/apiPermissions";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils";
import { botControlCmd } from "../types";
import moment from "moment-timezone";
import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types";
export const AddServerFromInviteCmd = botControlCmd({
trigger: ["add_server_from_invite", "allow_server_from_invite", "adv"],

View file

@ -1,9 +1,9 @@
import { ApiPermissions } from "@shared/apiPermissions";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { DBDateFormat, isSnowflake } from "../../../utils";
import { botControlCmd } from "../types";
import moment from "moment-timezone";
export const AllowServerCmd = botControlCmd({
trigger: ["allow_server", "allowserver", "add_server", "addserver"],

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { isGuildInvite, resolveInvite } from "../../../utils";
import { botControlCmd } from "../types";
import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types";
export const EligibleCmd = botControlCmd({
trigger: ["eligible", "is_eligible", "iseligible"],

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { GuildArchives } from "../../../data/GuildArchives";
import { getBaseUrl } from "../../../pluginUtils";
import { sorter } from "../../../utils";
import { botControlCmd } from "../types";
import { GuildArchives } from "../../../data/GuildArchives";
import moment from "moment-timezone";
const sortProps = {
totalTime: "TOTAL TIME",

View file

@ -1,8 +1,8 @@
import { botControlCmd } from "../types";
import { getRateLimitStats } from "../../../rateLimitStats";
import moment from "moment-timezone";
import { GuildArchives } from "../../../data/GuildArchives";
import { getBaseUrl, sendSuccessMessage } from "../../../pluginUtils";
import { getRateLimitStats } from "../../../rateLimitStats";
import { botControlCmd } from "../types";
export const RateLimitPerformanceCmd = botControlCmd({
trigger: ["rate_limit_performance"],

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getTopRestCallStats } from "../../../restCallStats";
import { createChunkedMessage } from "../../../utils";
import { botControlCmd } from "../types";
import { getTopRestCallStats } from "../../../restCallStats";
const leadingPathRegex = /(?<=\().+\/backend\//g;

View file

@ -1,7 +1,7 @@
import { User } from "discord.js";
import { BotControlPluginType } from "../types";
import { GlobalPluginData } from "knub";
import { GuildInvite } from "../../../utils";
import { BotControlPluginType } from "../types";
const REQUIRED_MEMBER_COUNT = 5000;

View file

@ -1,5 +1,5 @@
import * as t from "io-ts";
import { BasePluginType, globalPluginMessageCommand, globalPluginEventListener } from "knub";
import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";

View file

@ -5,6 +5,7 @@ import { GuildCases } from "../../data/GuildCases";
import { GuildLogs } from "../../data/GuildLogs";
import { mapToPublicFn } from "../../pluginUtils";
import { trimPluginDescription } from "../../utils";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { createCase } from "./functions/createCase";
@ -16,7 +17,6 @@ import { getRecentCasesByMod } from "./functions/getRecentCasesByMod";
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod";
import { postCaseToCaseLogChannel } from "./functions/postToCaseLogChannel";
import { CaseArgs, CaseNoteArgs, CasesPluginType, ConfigSchema } from "./types";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
const defaultOptions = {
config: {

View file

@ -1,10 +1,10 @@
import type { Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { logger } from "../../../logger";
import { resolveUser } from "../../../utils";
import { CaseArgs, CasesPluginType } from "../types";
import { createCaseNote } from "./createCaseNote";
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
import type { Snowflake } from "discord.js";
export async function createCase(pluginData: GuildPluginData<CasesPluginType>, args: CaseArgs) {
const user = await resolveUser(pluginData.client, args.userId);

View file

@ -1,4 +1,4 @@
import { escapeCodeBlock, MessageEditOptions, MessageCreateOptions } from "discord.js";
import { escapeCodeBlock, MessageCreateOptions, MessageEditOptions } from "discord.js";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { CaseTypes } from "../../../data/CaseTypes";

View file

@ -2,12 +2,12 @@ import { MessageCreateOptions, NewsChannel, RESTJSONErrorCodes, Snowflake, TextC
import { GuildPluginData } from "knub";
import { Case } from "../../../data/entities/Case";
import { isDiscordAPIError } from "../../../utils";
import { InternalPosterMessageResult } from "../../InternalPoster/functions/sendMessage";
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { CasesPluginType } from "../types";
import { getCaseEmbed } from "./getCaseEmbed";
import { resolveCaseId } from "./resolveCaseId";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin";
import { InternalPosterMessageResult } from "../../InternalPoster/functions/sendMessage";
export async function postToCaseLogChannel(
pluginData: GuildPluginData<CasesPluginType>,

View file

@ -1,4 +1,4 @@
import { Invite, Embed } from "discord.js";
import { Embed, Invite } from "discord.js";
import escapeStringRegexp from "escape-string-regexp";
import { GuildPluginData } from "knub";
import cloneDeep from "lodash.clonedeep";

View file

@ -3,8 +3,8 @@ import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { LogType } from "../../../data/LogType";
import { resolveUser } from "../../../utils";
import { CensorPluginType } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { CensorPluginType } from "../types";
export async function censorMessage(
pluginData: GuildPluginData<CensorPluginType>,

View file

@ -1,4 +1,4 @@
import { GuildTextBasedChannel, Attachment, MessageCreateOptions } from "discord.js";
import { Attachment, GuildTextBasedChannel, MessageCreateOptions } from "discord.js";
import fs from "fs";
import { downloadFile } from "../../utils";
const fsp = fs.promises;

View file

@ -2,10 +2,10 @@ import { PermissionsBitField, Snowflake, StageChannel, TextChannel, VoiceChannel
import { GuildPluginData } from "knub";
import { LogType } from "../../../data/LogType";
import { isDiscordAPIError, MINUTES } from "../../../utils";
import { filterObject } from "../../../utils/filterObject";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { CompanionChannelsPluginType, TCompanionChannelOpts } from "../types";
import { getCompanionChannelOptsForVoiceChannelId } from "./getCompanionChannelOptsForVoiceChannelId";
import { filterObject } from "../../../utils/filterObject";
const ERROR_COOLDOWN_KEY = "errorCooldown";
const ERROR_COOLDOWN = 5 * MINUTES;

View file

@ -2,11 +2,11 @@ import { PluginOptions } from "knub";
import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks";
import { LogsPlugin } from "../Logs/LogsPlugin";
import { MutesPlugin } from "../Mutes/MutesPlugin";
import { UtilityPlugin } from "../Utility/UtilityPlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ContextClickedEvt } from "./events/ContextClickedEvt";
import { ConfigSchema, ContextMenuPluginType } from "./types";
import { loadAllCommands } from "./utils/loadAllCommands";
import { UtilityPlugin } from "../Utility/UtilityPlugin";
const defaultOptions: PluginOptions<ContextMenuPluginType> = {
config: {

View file

@ -1,6 +1,6 @@
import { ApplicationCommandData, ApplicationCommandType } from "discord.js";
import { LogsPlugin } from "../../../plugins/Logs/LogsPlugin";
import { GuildPluginData } from "knub";
import { LogsPlugin } from "../../../plugins/Logs/LogsPlugin";
import { ContextMenuPluginType } from "../types";
import { hardcodedContext } from "./hardcodedContextOptions";

View file

@ -1,18 +1,18 @@
import { parseSignature, guildPluginMessageCommand } from "knub";
import { GuildChannel, GuildMember, User } from "discord.js";
import { guildPluginMessageCommand, parseSignature } from "knub";
import { commandTypes } from "../../commandTypes";
import { UnknownUser } from "../../utils";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { runEvent } from "./functions/runEvent";
import { ConfigSchema, CustomEventsPluginType } from "./types";
import { createTypedTemplateSafeValueContainer, TemplateSafeValueContainer } from "../../templateFormatter";
import { GuildChannel, GuildMember, ThreadChannel, User } from "discord.js";
import { UnknownUser } from "../../utils";
import { isScalar } from "../../utils/isScalar";
import {
channelToTemplateSafeChannel,
memberToTemplateSafeMember,
messageToTemplateSafeMessage,
userToTemplateSafeUser,
} from "../../utils/templateSafeObjects";
import { isScalar } from "../../utils/isScalar";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { runEvent } from "./functions/runEvent";
import { ConfigSchema, CustomEventsPluginType } from "./types";
const defaultOptions = {
config: {

View file

@ -1,10 +1,10 @@
import { Snowflake } from "discord.js";
import * as t from "io-ts";
import { GuildPluginData } from "knub";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
import { convertDelayStringToMS, noop, tDelayString } from "../../../utils";
import { ActionError } from "../ActionError";
import { CustomEventsPluginType, TCustomEvent } from "../types";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
export const MakeRoleMentionableAction = t.type({
type: t.literal("make_role_mentionable"),

View file

@ -1,9 +1,9 @@
import { Snowflake } from "discord.js";
import * as t from "io-ts";
import { GuildPluginData } from "knub";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
import { ActionError } from "../ActionError";
import { CustomEventsPluginType, TCustomEvent } from "../types";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
export const MakeRoleUnmentionableAction = t.type({
type: t.literal("make_role_unmentionable"),

View file

@ -1,9 +1,9 @@
import { Snowflake, PermissionsString, PermissionsBitField } from "discord.js";
import { PermissionsBitField, PermissionsString, Snowflake } from "discord.js";
import * as t from "io-ts";
import { GuildPluginData } from "knub";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
import { ActionError } from "../ActionError";
import { CustomEventsPluginType, TCustomEvent } from "../types";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
export const SetChannelPermissionOverridesAction = t.type({
type: t.literal("set_channel_permission_overrides"),

View file

@ -1,6 +1,7 @@
import { Message } from "discord.js";
import { GuildPluginData } from "knub";
import { sendErrorMessage } from "../../../pluginUtils";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
import { ActionError } from "../ActionError";
import { addRoleAction } from "../actions/addRoleAction";
import { createCaseAction } from "../actions/createCaseAction";
@ -10,7 +11,6 @@ import { messageAction } from "../actions/messageAction";
import { moveToVoiceChannelAction } from "../actions/moveToVoiceChannelAction";
import { setChannelPermissionOverridesAction } from "../actions/setChannelPermissionOverrides";
import { CustomEventsPluginType, TCustomEvent } from "../types";
import { TemplateSafeValueContainer } from "../../../templateFormatter";
export async function runEvent(
pluginData: GuildPluginData<CustomEventsPluginType>,

View file

@ -2,9 +2,9 @@ import { Guild } from "discord.js";
import * as t from "io-ts";
import { BasePluginType, GlobalPluginData, globalPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
import { env } from "../../env";
import { Configs } from "../../data/Configs";
import { env } from "../../env";
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
interface GuildAccessMonitorPluginType extends BasePluginType {
config: {};

View file

@ -1,11 +1,11 @@
import { Guild } from "discord.js";
import * as t from "io-ts";
import { guildPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
import { MINUTES } from "../../utils";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { GuildInfoSaverPluginType } from "./types";
import { Guild } from "discord.js";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
export const GuildInfoSaverPlugin = zeppelinGuildPlugin<GuildInfoSaverPluginType>()({
name: "guild_info_saver",

View file

@ -1,11 +1,11 @@
import { PluginOptions } from "knub";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, InternalPosterPluginType } from "./types";
import { mapToPublicFn } from "../../pluginUtils";
import { Webhooks } from "../../data/Webhooks";
import { mapToPublicFn } from "../../pluginUtils";
import { Queue } from "../../Queue";
import { sendMessage } from "./functions/sendMessage";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { editMessage } from "./functions/editMessage";
import { sendMessage } from "./functions/sendMessage";
import { ConfigSchema, InternalPosterPluginType } from "./types";
const defaultOptions: PluginOptions<InternalPosterPluginType> = {
config: {},

View file

@ -1,7 +1,7 @@
import { Message, MessageEditOptions, WebhookClient, WebhookMessageEditOptions } from "discord.js";
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { isDiscordAPIError, noop } from "../../../utils";
import { InternalPosterPluginType } from "../types";
/**
* Sends a message using a webhook or direct API requests, preferring webhooks when possible.

View file

@ -1,6 +1,6 @@
import { WebhookClient } from "discord.js";
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { WebhookClient } from "discord.js";
import { getOrCreateWebhookForChannel, WebhookableChannel } from "./getOrCreateWebhookForChannel";
export async function getOrCreateWebhookClientForChannel(

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { GuildBasedChannel, PermissionsBitField } from "discord.js";
import { GuildPluginData } from "knub";
import { isDiscordAPIError } from "../../../utils";
import { InternalPosterPluginType } from "../types";
type WebhookInfo = [id: string, token: string];

View file

@ -1,9 +1,9 @@
import { GuildTextBasedChannel, MessageCreateOptions, WebhookClient } from "discord.js";
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { channelIsWebhookable } from "./getOrCreateWebhookForChannel";
import { isDiscordAPIError } from "../../../utils";
import { InternalPosterPluginType } from "../types";
import { getOrCreateWebhookClientForChannel } from "./getOrCreateWebhookClientForChannel";
import { channelIsWebhookable } from "./getOrCreateWebhookForChannel";
export type InternalPosterMessageResult = {
id: string;

View file

@ -1,8 +1,8 @@
import { WebhookClient } from "discord.js";
import * as t from "io-ts";
import { BasePluginType } from "knub";
import { Webhooks } from "../../data/Webhooks";
import { Queue } from "../../Queue";
import { WebhookClient } from "discord.js";
export const ConfigSchema = t.type({});
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;

View file

@ -1,4 +1,5 @@
import { PluginOptions } from "knub";
import { onGuildEvent } from "../../data/GuildEvents";
import { GuildVCAlerts } from "../../data/GuildVCAlerts";
import { trimPluginDescription } from "../../utils";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
@ -8,9 +9,8 @@ import { WhereCmd } from "./commands/WhereCmd";
import { GuildBanRemoveAlertsEvt } from "./events/BanRemoveAlertsEvt";
import { VoiceStateUpdateAlertEvt } from "./events/SendAlertsEvts";
import { ConfigSchema, LocateUserPluginType } from "./types";
import { fillActiveAlertsList } from "./utils/fillAlertsList";
import { onGuildEvent } from "../../data/GuildEvents";
import { clearExpiredAlert } from "./utils/clearExpiredAlert";
import { fillActiveAlertsList } from "./utils/fillAlertsList";
const defaultOptions: PluginOptions<LocateUserPluginType> = {
config: {

View file

@ -1,10 +1,10 @@
import humanizeDuration from "humanize-duration";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { MINUTES, SECONDS } from "../../../utils";
import { locateUserCmd } from "../types";
import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
export const FollowCmd = locateUserCmd({
trigger: ["follow", "f"],

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { createChunkedMessage, sorter } from "../../../utils";
import { locateUserCmd } from "../types";
import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
export const ListFollowCmd = locateUserCmd({
trigger: ["follows", "fs"],

View file

@ -1,5 +1,5 @@
import { locateUserEvt } from "../types";
import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { locateUserEvt } from "../types";
export const GuildBanRemoveAlertsEvt = locateUserEvt({
event: "guildBanAdd",

View file

@ -1,5 +1,5 @@
import * as t from "io-ts";
import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { BasePluginType, guildPluginEventListener, guildPluginMessageCommand } from "knub";
import { GuildVCAlerts } from "../../data/GuildVCAlerts";
export const ConfigSchema = t.type({

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { VCAlert } from "../../../data/entities/VCAlert";
import { LocateUserPluginType } from "../types";
import { removeUserIdFromActiveAlerts } from "./removeUserIdFromActiveAlerts";
import { VCAlert } from "../../../data/entities/VCAlert";
export async function clearExpiredAlert(pluginData: GuildPluginData<LocateUserPluginType>, alert: VCAlert) {
await pluginData.state.alerts.delete(alert.id);

View file

@ -1,4 +1,4 @@
import { GuildMember, Snowflake, GuildTextBasedChannel } from "discord.js";
import { GuildMember, GuildTextBasedChannel, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { sendErrorMessage } from "../../../pluginUtils";
import { LocateUserPluginType } from "../types";

View file

@ -6,18 +6,12 @@ import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { LogType } from "../../data/LogType";
import { logger } from "../../logger";
import { mapToPublicFn } from "../../pluginUtils";
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
import { createTypedTemplateSafeValueContainer, TypedTemplateSafeValueContainer } from "../../templateFormatter";
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { LogsChannelCreateEvt, LogsChannelDeleteEvt, LogsChannelUpdateEvt } from "./events/LogsChannelModifyEvts";
import { LogsGuildMemberAddEvt } from "./events/LogsGuildMemberAddEvt";
import { LogsGuildMemberRemoveEvt } from "./events/LogsGuildMemberRemoveEvt";
import { LogsRoleCreateEvt, LogsRoleDeleteEvt, LogsRoleUpdateEvt } from "./events/LogsRoleModifyEvts";
import {
LogsStageInstanceCreateEvt,
LogsStageInstanceDeleteEvt,
LogsStageInstanceUpdateEvt,
} from "./events/LogsStageInstanceModifyEvts";
import {
LogsEmojiCreateEvt,
LogsEmojiDeleteEvt,
@ -26,6 +20,14 @@ import {
LogsStickerDeleteEvt,
LogsStickerUpdateEvt,
} from "./events/LogsEmojiAndStickerModifyEvts";
import { LogsGuildMemberAddEvt } from "./events/LogsGuildMemberAddEvt";
import { LogsGuildMemberRemoveEvt } from "./events/LogsGuildMemberRemoveEvt";
import { LogsRoleCreateEvt, LogsRoleDeleteEvt, LogsRoleUpdateEvt } from "./events/LogsRoleModifyEvts";
import {
LogsStageInstanceCreateEvt,
LogsStageInstanceDeleteEvt,
LogsStageInstanceUpdateEvt,
} from "./events/LogsStageInstanceModifyEvts";
import { LogsThreadCreateEvt, LogsThreadDeleteEvt, LogsThreadUpdateEvt } from "./events/LogsThreadModifyEvts";
import { LogsGuildMemberUpdateEvt } from "./events/LogsUserUpdateEvts";
import { LogsVoiceStateUpdateEvt } from "./events/LogsVoiceChannelEvts";
@ -35,9 +37,9 @@ import { log } from "./util/log";
import { onMessageDelete } from "./util/onMessageDelete";
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
import { onMessageUpdate } from "./util/onMessageUpdate";
import { createTypedTemplateSafeValueContainer, TypedTemplateSafeValueContainer } from "../../templateFormatter";
import { mapToPublicFn } from "../../pluginUtils";
import { escapeCodeBlock } from "discord.js";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
import { logAutomodAction } from "./logFunctions/logAutomodAction";
import { logBotAlert } from "./logFunctions/logBotAlert";
import { logCaseCreate } from "./logFunctions/logCaseCreate";
@ -48,6 +50,7 @@ import { logChannelCreate } from "./logFunctions/logChannelCreate";
import { logChannelDelete } from "./logFunctions/logChannelDelete";
import { logChannelUpdate } from "./logFunctions/logChannelUpdate";
import { logClean } from "./logFunctions/logClean";
import { logDmFailed } from "./logFunctions/logDmFailed";
import { logEmojiCreate } from "./logFunctions/logEmojiCreate";
import { logEmojiDelete } from "./logFunctions/logEmojiDelete";
import { logEmojiUpdate } from "./logFunctions/logEmojiUpdate";
@ -71,6 +74,7 @@ import { logMemberRoleChanges } from "./logFunctions/logMemberRoleChanges";
import { logMemberRoleRemove } from "./logFunctions/logMemberRoleRemove";
import { logMemberTimedBan } from "./logFunctions/logMemberTimedBan";
import { logMemberTimedMute } from "./logFunctions/logMemberTimedMute";
import { logMemberTimedUnban } from "./logFunctions/logMemberTimedUnban";
import { logMemberTimedUnmute } from "./logFunctions/logMemberTimedUnmute";
import { logMemberUnban } from "./logFunctions/logMemberUnban";
import { logMemberUnmute } from "./logFunctions/logMemberUnmute";
@ -105,10 +109,6 @@ import { logVoiceChannelForceMove } from "./logFunctions/logVoiceChannelForceMov
import { logVoiceChannelJoin } from "./logFunctions/logVoiceChannelJoin";
import { logVoiceChannelLeave } from "./logFunctions/logVoiceChannelLeave";
import { logVoiceChannelMove } from "./logFunctions/logVoiceChannelMove";
import { logMemberTimedUnban } from "./logFunctions/logMemberTimedUnban";
import { logDmFailed } from "./logFunctions/logDmFailed";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
import { escapeCodeBlock } from "discord.js";
const defaultOptions: PluginOptions<LogsPluginType> = {
config: {

View file

@ -1,10 +1,10 @@
import { TextChannel, VoiceChannel } from "discord.js";
import { differenceToString, getScalarDifference } from "../../../utils";
import { logsEvt } from "../types";
import { filterObject } from "../../../utils/filterObject";
import { logChannelCreate } from "../logFunctions/logChannelCreate";
import { logChannelDelete } from "../logFunctions/logChannelDelete";
import { logChannelUpdate } from "../logFunctions/logChannelUpdate";
import { TextChannel, VoiceChannel } from "discord.js";
import { filterObject } from "../../../utils/filterObject";
import { logsEvt } from "../types";
export const LogsChannelCreateEvt = logsEvt({
event: "channelCreate",

Some files were not shown because too many files have changed in this diff Show more