mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Organise all imports, make Mutes depend on Logs
This commit is contained in:
parent
a94e7593ec
commit
6ac9d2f2a2
437 changed files with 1912 additions and 2027 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { RegExpWorker, TimeoutError } from "regexp-worker";
|
|
||||||
import { CooldownManager } from "knub";
|
|
||||||
import { MINUTES, SECONDS } from "./utils";
|
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
|
import { CooldownManager } from "knub";
|
||||||
|
import { RegExpWorker, TimeoutError } from "regexp-worker";
|
||||||
|
import { MINUTES, SECONDS } from "./utils";
|
||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
|
|
||||||
const isTimeoutError = (a): a is TimeoutError => {
|
const isTimeoutError = (a): a is TimeoutError => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
|
import moment from "moment-timezone";
|
||||||
import { GuildArchives } from "../data/GuildArchives";
|
import { GuildArchives } from "../data/GuildArchives";
|
||||||
import { notFound } from "./responses";
|
import { notFound } from "./responses";
|
||||||
import moment from "moment-timezone";
|
|
||||||
|
|
||||||
export function initArchives(app: express.Express) {
|
export function initArchives(app: express.Express) {
|
||||||
const archives = new GuildArchives(null);
|
const archives = new GuildArchives(null);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import passport from "passport";
|
|
||||||
import OAuth2Strategy from "passport-oauth2";
|
|
||||||
import { Strategy as CustomStrategy } from "passport-custom";
|
|
||||||
import { ApiLogins } from "../data/ApiLogins";
|
|
||||||
import pick from "lodash.pick";
|
|
||||||
import https from "https";
|
import https from "https";
|
||||||
|
import pick from "lodash.pick";
|
||||||
|
import passport from "passport";
|
||||||
|
import { Strategy as CustomStrategy } from "passport-custom";
|
||||||
|
import OAuth2Strategy from "passport-oauth2";
|
||||||
|
import { ApiLogins } from "../data/ApiLogins";
|
||||||
|
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
||||||
import { ApiUserInfo } from "../data/ApiUserInfo";
|
import { ApiUserInfo } from "../data/ApiUserInfo";
|
||||||
import { ApiUserInfoData } from "../data/entities/ApiUserInfo";
|
import { ApiUserInfoData } from "../data/entities/ApiUserInfo";
|
||||||
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
|
||||||
import { ok } from "./responses";
|
import { ok } from "./responses";
|
||||||
|
|
||||||
interface IPassportApiUser {
|
interface IPassportApiUser {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { guildPlugins } from "../plugins/availablePlugins";
|
import { guildPlugins } from "../plugins/availablePlugins";
|
||||||
import { notFound } from "./responses";
|
|
||||||
import { indentLines } from "../utils";
|
import { indentLines } from "../utils";
|
||||||
|
import { notFound } from "./responses";
|
||||||
|
|
||||||
function formatConfigSchema(schema) {
|
function formatConfigSchema(schema) {
|
||||||
if (schema._tag === "InterfaceType" || schema._tag === "PartialType") {
|
if (schema._tag === "InterfaceType" || schema._tag === "PartialType") {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import express, { Request, Response } from "express";
|
|
||||||
import { AllowedGuilds } from "../data/AllowedGuilds";
|
|
||||||
import { clientError, ok, serverError, unauthorized } from "./responses";
|
|
||||||
import { Configs } from "../data/Configs";
|
|
||||||
import { validateGuildConfig } from "../configValidator";
|
|
||||||
import yaml, { YAMLException } from "js-yaml";
|
|
||||||
import { apiTokenAuthHandlers } from "./auth";
|
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@shared/apiPermissions";
|
||||||
import { hasGuildPermission, requireGuildPermission } from "./permissions";
|
import express, { Request, Response } from "express";
|
||||||
|
import yaml, { YAMLException } from "js-yaml";
|
||||||
|
import { validateGuildConfig } from "../configValidator";
|
||||||
|
import { AllowedGuilds } from "../data/AllowedGuilds";
|
||||||
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
||||||
|
import { Configs } from "../data/Configs";
|
||||||
|
import { apiTokenAuthHandlers } from "./auth";
|
||||||
|
import { hasGuildPermission, requireGuildPermission } from "./permissions";
|
||||||
|
import { clientError, ok, serverError, unauthorized } from "./responses";
|
||||||
|
|
||||||
const apiPermissionAssignments = new ApiPermissionAssignments();
|
const apiPermissionAssignments = new ApiPermissionAssignments();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
import { connect } from "../data/db";
|
||||||
|
import { setIsAPI } from "../globals";
|
||||||
import "./loadEnv";
|
import "./loadEnv";
|
||||||
|
|
||||||
import { connect } from "../data/db";
|
|
||||||
import path from "path";
|
|
||||||
import { setIsAPI } from "../globals";
|
|
||||||
|
|
||||||
if (!process.env.KEY) {
|
if (!process.env.KEY) {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ApiPermissions, hasPermission, permissionArrToSet } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission, permissionArrToSet } from "@shared/apiPermissions";
|
||||||
import { isStaff } from "../staff";
|
|
||||||
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
|
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
||||||
|
import { isStaff } from "../staff";
|
||||||
import { unauthorized } from "./responses";
|
import { unauthorized } from "./responses";
|
||||||
|
|
||||||
const apiPermissionAssignments = new ApiPermissionAssignments();
|
const apiPermissionAssignments = new ApiPermissionAssignments();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import { apiTokenAuthHandlers } from "./auth";
|
|
||||||
import { isStaff } from "../staff";
|
import { isStaff } from "../staff";
|
||||||
|
import { apiTokenAuthHandlers } from "./auth";
|
||||||
|
|
||||||
export function initStaff(app: express.Express) {
|
export function initStaff(app: express.Express) {
|
||||||
const staffRouter = express.Router();
|
const staffRouter = express.Router();
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { clientError, error, notFound } from "./responses";
|
|
||||||
import express from "express";
|
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import { initAuth } from "./auth";
|
import express from "express";
|
||||||
import { initGuildsAPI } from "./guilds";
|
|
||||||
import { initArchives } from "./archives";
|
|
||||||
import { initDocs } from "./docs";
|
|
||||||
import { TokenError } from "passport-oauth2";
|
import { TokenError } from "passport-oauth2";
|
||||||
|
import { initArchives } from "./archives";
|
||||||
|
import { initAuth } from "./auth";
|
||||||
|
import { initDocs } from "./docs";
|
||||||
|
import { initGuildsAPI } from "./guilds";
|
||||||
|
import { clientError, error, notFound } from "./responses";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import {
|
import { GuildChannel, GuildMember, User } from "discord.js";
|
||||||
channelMentionRegex,
|
import { baseCommandParameterTypeHelpers, baseTypeConverters, CommandContext, TypeConversionError } from "knub";
|
||||||
convertDelayStringToMS,
|
|
||||||
disableCodeBlocks,
|
|
||||||
disableInlineCode,
|
|
||||||
isValidSnowflake,
|
|
||||||
resolveMember,
|
|
||||||
resolveUser,
|
|
||||||
resolveUserId,
|
|
||||||
roleMentionRegex,
|
|
||||||
UnknownUser,
|
|
||||||
} from "./utils";
|
|
||||||
import { baseTypeConverters, baseCommandParameterTypeHelpers, CommandContext, TypeConversionError } from "knub";
|
|
||||||
import { createTypeHelper } from "knub-command-manager";
|
import { createTypeHelper } from "knub-command-manager";
|
||||||
|
import {
|
||||||
|
channelMentionRegex,
|
||||||
|
convertDelayStringToMS,
|
||||||
|
disableCodeBlocks,
|
||||||
|
disableInlineCode,
|
||||||
|
isValidSnowflake,
|
||||||
|
resolveMember,
|
||||||
|
resolveUser,
|
||||||
|
resolveUserId,
|
||||||
|
roleMentionRegex,
|
||||||
|
UnknownUser
|
||||||
|
} from "./utils";
|
||||||
|
import { isValidTimezone } from "./utils/isValidTimezone";
|
||||||
import { MessageTarget, resolveMessageTarget } from "./utils/resolveMessageTarget";
|
import { MessageTarget, resolveMessageTarget } from "./utils/resolveMessageTarget";
|
||||||
import { inputPatternToRegExp } from "./validatorUtils";
|
import { inputPatternToRegExp } from "./validatorUtils";
|
||||||
import { isValidTimezone } from "./utils/isValidTimezone";
|
|
||||||
import { GuildChannel, GuildMember, User } from "discord.js";
|
|
||||||
|
|
||||||
export const commandTypes = {
|
export const commandTypes = {
|
||||||
...baseTypeConverters,
|
...baseTypeConverters,
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import * as t from "io-ts";
|
|
||||||
import { guildPlugins } from "./plugins/availablePlugins";
|
|
||||||
import { decodeAndValidateStrict, StrictValidationError } from "./validatorUtils";
|
|
||||||
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
|
||||||
import { PartialZeppelinGuildConfigSchema, ZeppelinGuildConfig } from "./types";
|
|
||||||
import { configUtils, ConfigValidationError, PluginOptions } from "knub";
|
import { configUtils, ConfigValidationError, PluginOptions } from "knub";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
import { guildPlugins } from "./plugins/availablePlugins";
|
||||||
|
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
||||||
|
import { PartialZeppelinGuildConfigSchema, ZeppelinGuildConfig } from "./types";
|
||||||
|
import { decodeAndValidateStrict, StrictValidationError } from "./validatorUtils";
|
||||||
|
|
||||||
const pluginNameToPlugin = new Map<string, ZeppelinPlugin>();
|
const pluginNameToPlugin = new Map<string, ZeppelinPlugin>();
|
||||||
for (const plugin of guildPlugins) {
|
for (const plugin of guildPlugins) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AllowedGuild } from "./entities/AllowedGuild";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { BaseRepository } from "./BaseRepository";
|
|
||||||
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
|
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
|
||||||
|
import { BaseRepository } from "./BaseRepository";
|
||||||
|
import { AllowedGuild } from "./entities/AllowedGuild";
|
||||||
|
|
||||||
export class AllowedGuilds extends BaseRepository {
|
export class AllowedGuilds extends BaseRepository {
|
||||||
private allowedGuilds: Repository<AllowedGuild>;
|
private allowedGuilds: Repository<AllowedGuild>;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { getRepository, Repository } from "typeorm";
|
|
||||||
import { ApiLogin } from "./entities/ApiLogin";
|
|
||||||
import { BaseRepository } from "./BaseRepository";
|
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
import { getRepository, Repository } from "typeorm";
|
||||||
// tslint:disable-next-line:no-submodule-imports
|
// tslint:disable-next-line:no-submodule-imports
|
||||||
import uuidv4 from "uuid/v4";
|
import uuidv4 from "uuid/v4";
|
||||||
import { DAYS, DBDateFormat } from "../utils";
|
import { DAYS, DBDateFormat } from "../utils";
|
||||||
|
import { BaseRepository } from "./BaseRepository";
|
||||||
|
import { ApiLogin } from "./entities/ApiLogin";
|
||||||
|
|
||||||
const LOGIN_EXPIRY_TIME = 1 * DAYS;
|
const LOGIN_EXPIRY_TIME = 1 * DAYS;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getRepository, Repository } from "typeorm";
|
|
||||||
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment";
|
|
||||||
import { BaseRepository } from "./BaseRepository";
|
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@shared/apiPermissions";
|
||||||
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseRepository } from "./BaseRepository";
|
||||||
|
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment";
|
||||||
|
|
||||||
export enum ApiPermissionTypes {
|
export enum ApiPermissionTypes {
|
||||||
User = "USER",
|
User = "USER",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import moment from "moment-timezone";
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { ApiUserInfo as ApiUserInfoEntity, ApiUserInfoData } from "./entities/ApiUserInfo";
|
import { DBDateFormat } from "../utils";
|
||||||
import { BaseRepository } from "./BaseRepository";
|
import { BaseRepository } from "./BaseRepository";
|
||||||
import { connection } from "./db";
|
import { connection } from "./db";
|
||||||
import moment from "moment-timezone";
|
import { ApiUserInfo as ApiUserInfoEntity, ApiUserInfoData } from "./entities/ApiUserInfo";
|
||||||
import { DBDateFormat } from "../utils";
|
|
||||||
|
|
||||||
export class ApiUserInfo extends BaseRepository {
|
export class ApiUserInfo extends BaseRepository {
|
||||||
private apiUserInfo: Repository<ApiUserInfoEntity>;
|
private apiUserInfo: Repository<ApiUserInfoEntity>;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Config } from "./entities/Config";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { connection } from "./db";
|
|
||||||
import { BaseRepository } from "./BaseRepository";
|
|
||||||
import { isAPI } from "../globals";
|
import { isAPI } from "../globals";
|
||||||
import { HOURS, SECONDS } from "../utils";
|
import { HOURS, SECONDS } from "../utils";
|
||||||
|
import { BaseRepository } from "./BaseRepository";
|
||||||
import { cleanupConfigs } from "./cleanup/configs";
|
import { cleanupConfigs } from "./cleanup/configs";
|
||||||
|
import { connection } from "./db";
|
||||||
|
import { Config } from "./entities/Config";
|
||||||
|
|
||||||
if (isAPI()) {
|
if (isAPI()) {
|
||||||
const CLEANUP_INTERVAL = 1 * HOURS;
|
const CLEANUP_INTERVAL = 1 * HOURS;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { AntiraidLevel } from "./entities/AntiraidLevel";
|
import { AntiraidLevel } from "./entities/AntiraidLevel";
|
||||||
|
|
||||||
export class GuildAntiraidLevels extends BaseGuildRepository {
|
export class GuildAntiraidLevels extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import moment from "moment-timezone";
|
|
||||||
import { ArchiveEntry } from "./entities/ArchiveEntry";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { trimLines } from "../utils";
|
|
||||||
import { SavedMessage } from "./entities/SavedMessage";
|
|
||||||
import { renderTemplate } from "../templateFormatter";
|
|
||||||
import { Guild } from "discord.js";
|
import { Guild } from "discord.js";
|
||||||
|
import moment from "moment-timezone";
|
||||||
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { renderTemplate } from "../templateFormatter";
|
||||||
|
import { trimLines } from "../utils";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { ArchiveEntry } from "./entities/ArchiveEntry";
|
||||||
|
import { SavedMessage } from "./entities/SavedMessage";
|
||||||
|
|
||||||
const DEFAULT_EXPIRY_DAYS = 30;
|
const DEFAULT_EXPIRY_DAYS = 30;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { AutoReaction } from "./entities/AutoReaction";
|
import { AutoReaction } from "./entities/AutoReaction";
|
||||||
|
|
||||||
export class GuildAutoReactions extends BaseGuildRepository {
|
export class GuildAutoReactions extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
import { getRepository, In, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { CaseTypes } from "./CaseTypes";
|
||||||
|
import { connection } from "./db";
|
||||||
import { Case } from "./entities/Case";
|
import { Case } from "./entities/Case";
|
||||||
import { CaseNote } from "./entities/CaseNote";
|
import { CaseNote } from "./entities/CaseNote";
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, In, Repository } from "typeorm";
|
|
||||||
import { DBDateFormat, disableLinkPreviews } from "../utils";
|
|
||||||
import { CaseTypes } from "./CaseTypes";
|
|
||||||
import moment = require("moment-timezone");
|
import moment = require("moment-timezone");
|
||||||
import { connection } from "./db";
|
|
||||||
|
|
||||||
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
|
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
|
import moment from "moment-timezone";
|
||||||
|
import { FindConditions, getRepository, In, IsNull, Not, Repository } from "typeorm";
|
||||||
|
import { Queue } from "../Queue";
|
||||||
|
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { FindConditions, getRepository, In, IsNull, LessThan, Not, Repository } from "typeorm";
|
import { connection } from "./db";
|
||||||
import { Counter } from "./entities/Counter";
|
import { Counter } from "./entities/Counter";
|
||||||
import { CounterValue } from "./entities/CounterValue";
|
|
||||||
import {
|
import {
|
||||||
CounterTrigger,
|
CounterTrigger,
|
||||||
isValidCounterComparisonOp,
|
isValidCounterComparisonOp,
|
||||||
TRIGGER_COMPARISON_OPS,
|
|
||||||
TriggerComparisonOp,
|
TriggerComparisonOp
|
||||||
} from "./entities/CounterTrigger";
|
} from "./entities/CounterTrigger";
|
||||||
import { CounterTriggerState } from "./entities/CounterTriggerState";
|
import { CounterTriggerState } from "./entities/CounterTriggerState";
|
||||||
import moment from "moment-timezone";
|
import { CounterValue } from "./entities/CounterValue";
|
||||||
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
|
|
||||||
import { connection } from "./db";
|
|
||||||
import { Queue } from "../Queue";
|
|
||||||
|
|
||||||
const DELETE_UNUSED_COUNTERS_AFTER = 1 * DAYS;
|
const DELETE_UNUSED_COUNTERS_AFTER = 1 * DAYS;
|
||||||
const DELETE_UNUSED_COUNTER_TRIGGERS_AFTER = 1 * DAYS;
|
const DELETE_UNUSED_COUNTER_TRIGGERS_AFTER = 1 * DAYS;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { QueuedEventEmitter } from "../QueuedEventEmitter";
|
import { QueuedEventEmitter } from "../QueuedEventEmitter";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
|
||||||
export class GuildEvents extends BaseGuildRepository {
|
export class GuildEvents extends BaseGuildRepository {
|
||||||
private queuedEventEmitter: QueuedEventEmitter;
|
private queuedEventEmitter: QueuedEventEmitter;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { MemberTimezone } from "./entities/MemberTimezone";
|
|
||||||
import { getRepository, Repository } from "typeorm/index";
|
import { getRepository, Repository } from "typeorm/index";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { connection } from "./db";
|
import { connection } from "./db";
|
||||||
|
import { MemberTimezone } from "./entities/MemberTimezone";
|
||||||
|
|
||||||
export class GuildMemberTimezones extends BaseGuildRepository {
|
export class GuildMemberTimezones extends BaseGuildRepository {
|
||||||
protected memberTimezones: Repository<MemberTimezone>;
|
protected memberTimezones: Repository<MemberTimezone>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { Mute } from "./entities/Mute";
|
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { Brackets, getRepository, Repository } from "typeorm";
|
import { Brackets, getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { Mute } from "./entities/Mute";
|
||||||
|
|
||||||
export class GuildMutes extends BaseGuildRepository {
|
export class GuildMutes extends BaseGuildRepository {
|
||||||
private mutes: Repository<Mute>;
|
private mutes: Repository<Mute>;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, In, Repository } from "typeorm";
|
import { getRepository, In, Repository } from "typeorm";
|
||||||
import { NicknameHistoryEntry } from "./entities/NicknameHistoryEntry";
|
|
||||||
import { MINUTES, SECONDS } from "../utils";
|
|
||||||
import { isAPI } from "../globals";
|
import { isAPI } from "../globals";
|
||||||
|
import { MINUTES, SECONDS } from "../utils";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { cleanupNicknames } from "./cleanup/nicknames";
|
import { cleanupNicknames } from "./cleanup/nicknames";
|
||||||
|
import { NicknameHistoryEntry } from "./entities/NicknameHistoryEntry";
|
||||||
|
|
||||||
if (!isAPI()) {
|
if (!isAPI()) {
|
||||||
const CLEANUP_INTERVAL = 5 * MINUTES;
|
const CLEANUP_INTERVAL = 5 * MINUTES;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { PersistedData } from "./entities/PersistedData";
|
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { PersistedData } from "./entities/PersistedData";
|
||||||
|
|
||||||
export interface IPartialPersistData {
|
export interface IPartialPersistData {
|
||||||
roles?: string[];
|
roles?: string[];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { PingableRole } from "./entities/PingableRole";
|
import { PingableRole } from "./entities/PingableRole";
|
||||||
|
|
||||||
export class GuildPingableRoles extends BaseGuildRepository {
|
export class GuildPingableRoles extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ReactionRole } from "./entities/ReactionRole";
|
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { ReactionRole } from "./entities/ReactionRole";
|
||||||
|
|
||||||
export class GuildReactionRoles extends BaseGuildRepository {
|
export class GuildReactionRoles extends BaseGuildRepository {
|
||||||
private reactionRoles: Repository<ReactionRole>;
|
private reactionRoles: Repository<ReactionRole>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { Reminder } from "./entities/Reminder";
|
import { Reminder } from "./entities/Reminder";
|
||||||
|
|
||||||
export class GuildReminders extends BaseGuildRepository {
|
export class GuildReminders extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { getRepository, Repository } from "typeorm";
|
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
|
|
||||||
import { QueuedEventEmitter } from "../QueuedEventEmitter";
|
|
||||||
import moment from "moment-timezone";
|
|
||||||
import { MINUTES, SECONDS } from "../utils";
|
|
||||||
import { isAPI } from "../globals";
|
|
||||||
import { cleanupMessages } from "./cleanup/messages";
|
|
||||||
import { GuildChannel, Message } from "discord.js";
|
import { GuildChannel, Message } from "discord.js";
|
||||||
|
import moment from "moment-timezone";
|
||||||
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { isAPI } from "../globals";
|
||||||
|
import { QueuedEventEmitter } from "../QueuedEventEmitter";
|
||||||
|
import { MINUTES, SECONDS } from "../utils";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { cleanupMessages } from "./cleanup/messages";
|
||||||
|
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
|
||||||
|
|
||||||
if (!isAPI()) {
|
if (!isAPI()) {
|
||||||
const CLEANUP_INTERVAL = 5 * MINUTES;
|
const CLEANUP_INTERVAL = 5 * MINUTES;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { ScheduledPost } from "./entities/ScheduledPost";
|
import { ScheduledPost } from "./entities/ScheduledPost";
|
||||||
|
|
||||||
export class GuildScheduledPosts extends BaseGuildRepository {
|
export class GuildScheduledPosts extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
import moment from "moment-timezone";
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { SlowmodeChannel } from "./entities/SlowmodeChannel";
|
import { SlowmodeChannel } from "./entities/SlowmodeChannel";
|
||||||
import { SlowmodeUser } from "./entities/SlowmodeUser";
|
import { SlowmodeUser } from "./entities/SlowmodeUser";
|
||||||
import moment from "moment-timezone";
|
|
||||||
|
|
||||||
export class GuildSlowmodes extends BaseGuildRepository {
|
export class GuildSlowmodes extends BaseGuildRepository {
|
||||||
private slowmodeChannels: Repository<SlowmodeChannel>;
|
private slowmodeChannels: Repository<SlowmodeChannel>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { StarboardMessage } from "./entities/StarboardMessage";
|
import { StarboardMessage } from "./entities/StarboardMessage";
|
||||||
|
|
||||||
export class GuildStarboardMessages extends BaseGuildRepository {
|
export class GuildStarboardMessages extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { StarboardReaction } from "./entities/StarboardReaction";
|
import { StarboardReaction } from "./entities/StarboardReaction";
|
||||||
|
|
||||||
export class GuildStarboardReactions extends BaseGuildRepository {
|
export class GuildStarboardReactions extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { StatValue } from "./entities/StatValue";
|
import { StatValue } from "./entities/StatValue";
|
||||||
|
|
||||||
export class GuildStats extends BaseGuildRepository {
|
export class GuildStats extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Tag } from "./entities/Tag";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
|
import { Tag } from "./entities/Tag";
|
||||||
import { TagResponse } from "./entities/TagResponse";
|
import { TagResponse } from "./entities/TagResponse";
|
||||||
|
|
||||||
export class GuildTags extends BaseGuildRepository {
|
export class GuildTags extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { Mute } from "./entities/Mute";
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { Brackets, getRepository, Repository } from "typeorm";
|
|
||||||
import { Tempban } from "./entities/Tempban";
|
import { Tempban } from "./entities/Tempban";
|
||||||
|
|
||||||
export class GuildTempbans extends BaseGuildRepository {
|
export class GuildTempbans extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseGuildRepository } from "./BaseGuildRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseGuildRepository } from "./BaseGuildRepository";
|
||||||
import { VCAlert } from "./entities/VCAlert";
|
import { VCAlert } from "./entities/VCAlert";
|
||||||
|
|
||||||
export class GuildVCAlerts extends BaseGuildRepository {
|
export class GuildVCAlerts extends BaseGuildRepository {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseRepository } from "./BaseRepository";
|
|
||||||
import { getRepository, Repository } from "typeorm";
|
import { getRepository, Repository } from "typeorm";
|
||||||
|
import { BaseRepository } from "./BaseRepository";
|
||||||
import { Supporter } from "./entities/Supporter";
|
import { Supporter } from "./entities/Supporter";
|
||||||
|
|
||||||
export class Supporters extends BaseRepository {
|
export class Supporters extends BaseRepository {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { getRepository, In, Repository } from "typeorm";
|
import { getRepository, In, Repository } from "typeorm";
|
||||||
import { UsernameHistoryEntry } from "./entities/UsernameHistoryEntry";
|
import { isAPI } from "../globals";
|
||||||
import { MINUTES, SECONDS } from "../utils";
|
import { MINUTES, SECONDS } from "../utils";
|
||||||
import { BaseRepository } from "./BaseRepository";
|
import { BaseRepository } from "./BaseRepository";
|
||||||
import { isAPI } from "../globals";
|
|
||||||
import { cleanupUsernames } from "./cleanup/usernames";
|
import { cleanupUsernames } from "./cleanup/usernames";
|
||||||
|
import { UsernameHistoryEntry } from "./entities/UsernameHistoryEntry";
|
||||||
|
|
||||||
if (!isAPI()) {
|
if (!isAPI()) {
|
||||||
const CLEANUP_INTERVAL = 5 * MINUTES;
|
const CLEANUP_INTERVAL = 5 * MINUTES;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { connection } from "../db";
|
|
||||||
import { getRepository, In } from "typeorm";
|
|
||||||
import { Config } from "../entities/Config";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
import { getRepository, In } from "typeorm";
|
||||||
import { DBDateFormat } from "../../utils";
|
import { DBDateFormat } from "../../utils";
|
||||||
|
import { connection } from "../db";
|
||||||
|
import { Config } from "../entities/Config";
|
||||||
|
|
||||||
const CLEAN_PER_LOOP = 50;
|
const CLEAN_PER_LOOP = 50;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { DAYS, DBDateFormat, MINUTES } from "../../utils";
|
|
||||||
import { getRepository, In } from "typeorm";
|
|
||||||
import { SavedMessage } from "../entities/SavedMessage";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
import { getRepository, In } from "typeorm";
|
||||||
|
import { DAYS, DBDateFormat, MINUTES } from "../../utils";
|
||||||
import { connection } from "../db";
|
import { connection } from "../db";
|
||||||
|
import { SavedMessage } from "../entities/SavedMessage";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How long message edits, deletions, etc. will include the original message content.
|
* How long message edits, deletions, etc. will include the original message content.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getRepository, In } from "typeorm";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { NicknameHistoryEntry } from "../entities/NicknameHistoryEntry";
|
import { getRepository, In } from "typeorm";
|
||||||
import { DAYS, DBDateFormat } from "../../utils";
|
import { DAYS, DBDateFormat } from "../../utils";
|
||||||
import { connection } from "../db";
|
import { connection } from "../db";
|
||||||
|
import { NicknameHistoryEntry } from "../entities/NicknameHistoryEntry";
|
||||||
|
|
||||||
export const NICKNAME_RETENTION_PERIOD = 30 * DAYS;
|
export const NICKNAME_RETENTION_PERIOD = 30 * DAYS;
|
||||||
const CLEAN_PER_LOOP = 500;
|
const CLEAN_PER_LOOP = 500;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getRepository, In } from "typeorm";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { UsernameHistoryEntry } from "../entities/UsernameHistoryEntry";
|
import { getRepository, In } from "typeorm";
|
||||||
import { DAYS, DBDateFormat } from "../../utils";
|
import { DAYS, DBDateFormat } from "../../utils";
|
||||||
import { connection } from "../db";
|
import { connection } from "../db";
|
||||||
|
import { UsernameHistoryEntry } from "../entities/UsernameHistoryEntry";
|
||||||
|
|
||||||
export const USERNAME_RETENTION_PERIOD = 30 * DAYS;
|
export const USERNAME_RETENTION_PERIOD = 30 * DAYS;
|
||||||
const CLEAN_PER_LOOP = 500;
|
const CLEAN_PER_LOOP = 500;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SimpleError } from "../SimpleError";
|
|
||||||
import { Connection, createConnection } from "typeorm";
|
import { Connection, createConnection } from "typeorm";
|
||||||
|
import { SimpleError } from "../SimpleError";
|
||||||
|
|
||||||
let connectionPromise: Promise<Connection>;
|
let connectionPromise: Promise<Connection>;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { decrypt, encrypt } from "../utils/crypt";
|
|
||||||
import { ValueTransformer } from "typeorm";
|
import { ValueTransformer } from "typeorm";
|
||||||
|
import { decrypt, encrypt } from "../utils/crypt";
|
||||||
|
|
||||||
interface EncryptedJsonTransformer<T> extends ValueTransformer {
|
interface EncryptedJsonTransformer<T> extends ValueTransformer {
|
||||||
from(dbValue: any): T;
|
from(dbValue: any): T;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { decrypt, encrypt } from "../utils/crypt";
|
|
||||||
import { ValueTransformer } from "typeorm";
|
import { ValueTransformer } from "typeorm";
|
||||||
|
import { decrypt, encrypt } from "../utils/crypt";
|
||||||
|
|
||||||
interface EncryptedTextTransformer extends ValueTransformer {
|
interface EncryptedTextTransformer extends ValueTransformer {
|
||||||
from(dbValue: any): string;
|
from(dbValue: any): string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { getRepository, Repository } from "typeorm";
|
||||||
import { SavedMessage } from "./entities/SavedMessage";
|
import { SavedMessage } from "./entities/SavedMessage";
|
||||||
import { Repository, getRepository } from "typeorm";
|
|
||||||
|
|
||||||
let repository: Repository<SavedMessage>;
|
let repository: Repository<SavedMessage>;
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
import "./loadEnv";
|
import { Client, Intents, TextChannel } from "discord.js";
|
||||||
|
|
||||||
import path from "path";
|
|
||||||
import yaml from "js-yaml";
|
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import yaml from "js-yaml";
|
||||||
import { Knub, PluginError } from "knub";
|
import { Knub, PluginError } from "knub";
|
||||||
import { SimpleError } from "./SimpleError";
|
import { PluginLoadError } from "knub/dist/plugins/PluginLoadError";
|
||||||
|
|
||||||
import { Configs } from "./data/Configs";
|
|
||||||
// Always use UTC internally
|
// Always use UTC internally
|
||||||
// This is also enforced for the database in data/db.ts
|
// This is also enforced for the database in data/db.ts
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { connect } from "./data/db";
|
|
||||||
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
|
|
||||||
import { errorMessage, isDiscordHTTPError, isDiscordRESTError, MINUTES, successMessage } from "./utils";
|
|
||||||
import { startUptimeCounter } from "./uptime";
|
|
||||||
import { AllowedGuilds } from "./data/AllowedGuilds";
|
import { AllowedGuilds } from "./data/AllowedGuilds";
|
||||||
import { ZeppelinGlobalConfig, ZeppelinGuildConfig } from "./types";
|
import { Configs } from "./data/Configs";
|
||||||
import { RecoverablePluginError } from "./RecoverablePluginError";
|
import { connect } from "./data/db";
|
||||||
import { GuildLogs } from "./data/GuildLogs";
|
import { GuildLogs } from "./data/GuildLogs";
|
||||||
import { LogType } from "./data/LogType";
|
import { LogType } from "./data/LogType";
|
||||||
import { logger } from "./logger";
|
|
||||||
import { PluginLoadError } from "knub/dist/plugins/PluginLoadError";
|
|
||||||
import { ErisError } from "./ErisError";
|
import { ErisError } from "./ErisError";
|
||||||
import { Client, Intents, TextChannel } from "discord.js";
|
import "./loadEnv";
|
||||||
|
import { logger } from "./logger";
|
||||||
|
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
|
||||||
|
import { RecoverablePluginError } from "./RecoverablePluginError";
|
||||||
|
import { SimpleError } from "./SimpleError";
|
||||||
|
import { ZeppelinGlobalConfig, ZeppelinGuildConfig } from "./types";
|
||||||
|
import { startUptimeCounter } from "./uptime";
|
||||||
|
import { errorMessage, isDiscordHTTPError, isDiscordRESTError, successMessage } from "./utils";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// tslint:disable:no-console
|
// tslint:disable:no-console
|
||||||
import { connect } from "./data/db";
|
|
||||||
import { Configs } from "./data/Configs";
|
|
||||||
import path from "path";
|
|
||||||
import * as _fs from "fs";
|
import * as _fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
import { Configs } from "./data/Configs";
|
||||||
|
import { connect } from "./data/db";
|
||||||
|
|
||||||
const fs = _fs.promises;
|
const fs = _fs.promises;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrationInterface, QueryRunner, TableIndex, TableUnique } from "typeorm";
|
import { MigrationInterface, QueryRunner, TableIndex } from "typeorm";
|
||||||
|
|
||||||
export class FixStarboardReactionsIndices1608692857722 implements MigrationInterface {
|
export class FixStarboardReactionsIndices1608692857722 implements MigrationInterface {
|
||||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
* @file Utility functions that are plugin-instance-specific (i.e. use PluginData)
|
* @file Utility functions that are plugin-instance-specific (i.e. use PluginData)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CommandContext, configUtils, ConfigValidationError, GuildPluginData, helpers, PluginOptions } from "knub";
|
import { GuildMember, Message, MessageMentionOptions, MessageOptions, TextChannel } from "discord.js";
|
||||||
import { decodeAndValidateStrict, StrictValidationError, validate } from "./validatorUtils";
|
|
||||||
import { deepKeyIntersect, errorMessage, successMessage, tDeepPartial, tNullable } from "./utils";
|
|
||||||
import { TZeppelinKnub } from "./types";
|
|
||||||
import { ExtendedMatchParams } from "knub/dist/config/PluginConfigManager"; // TODO: Export from Knub index
|
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
|
import { CommandContext, configUtils, ConfigValidationError, GuildPluginData, helpers, PluginOptions } from "knub";
|
||||||
import { PluginOverrideCriteria } from "knub/dist/config/configTypes";
|
import { PluginOverrideCriteria } from "knub/dist/config/configTypes";
|
||||||
import { Tail } from "./utils/typeUtils";
|
import { ExtendedMatchParams } from "knub/dist/config/PluginConfigManager"; // TODO: Export from Knub index
|
||||||
import { AnyPluginData } from "knub/dist/plugins/PluginData";
|
import { AnyPluginData } from "knub/dist/plugins/PluginData";
|
||||||
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
|
||||||
import { logger } from "./logger";
|
import { logger } from "./logger";
|
||||||
import { APIMessage, GuildMember, Message, MessageMentionOptions, MessageOptions, TextChannel, User } from "discord.js";
|
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
||||||
|
import { TZeppelinKnub } from "./types";
|
||||||
|
import { deepKeyIntersect, errorMessage, successMessage, tDeepPartial, tNullable } from "./utils";
|
||||||
|
import { Tail } from "./utils/typeUtils";
|
||||||
|
import { decodeAndValidateStrict, StrictValidationError, validate } from "./validatorUtils";
|
||||||
|
|
||||||
const { getMemberLevel } = helpers;
|
const { getMemberLevel } = helpers;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { PluginOptions } from "knub";
|
import { PluginOptions } from "knub";
|
||||||
import { AutoDeletePluginType, ConfigSchema } from "./types";
|
|
||||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
|
||||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
|
||||||
import { GuildLogs } from "../../data/GuildLogs";
|
import { GuildLogs } from "../../data/GuildLogs";
|
||||||
|
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||||
|
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||||
|
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||||
|
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||||
|
import { AutoDeletePluginType, ConfigSchema } from "./types";
|
||||||
import { onMessageCreate } from "./util/onMessageCreate";
|
import { onMessageCreate } from "./util/onMessageCreate";
|
||||||
import { onMessageDelete } from "./util/onMessageDelete";
|
import { onMessageDelete } from "./util/onMessageDelete";
|
||||||
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
|
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
|
||||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
|
||||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
|
||||||
|
|
||||||
const defaultOptions: PluginOptions<AutoDeletePluginType> = {
|
const defaultOptions: PluginOptions<AutoDeletePluginType> = {
|
||||||
config: {
|
config: {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
import { BasePluginType } from "knub";
|
||||||
import { tDelayString, MINUTES } from "../../utils";
|
import { SavedMessage } from "../../data/entities/SavedMessage";
|
||||||
import { GuildLogs } from "../../data/GuildLogs";
|
import { GuildLogs } from "../../data/GuildLogs";
|
||||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||||
import { SavedMessage } from "../../data/entities/SavedMessage";
|
import { MINUTES, tDelayString } from "../../utils";
|
||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
|
|
||||||
export const MAX_DELAY = 5 * MINUTES;
|
export const MAX_DELAY = 5 * MINUTES;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutoDeletePluginType } from "../types";
|
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
|
||||||
import { sorter } from "../../../utils";
|
import { sorter } from "../../../utils";
|
||||||
|
import { AutoDeletePluginType } from "../types";
|
||||||
|
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||||
|
|
||||||
export function addMessageToDeletionQueue(
|
export function addMessageToDeletionQueue(
|
||||||
pluginData: GuildPluginData<AutoDeletePluginType>,
|
pluginData: GuildPluginData<AutoDeletePluginType>,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
import { Permissions, TextChannel } from "discord.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutoDeletePluginType } from "../types";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { resolveUser, stripObjectToScalars, verboseChannelMention } from "../../../utils";
|
|
||||||
import { logger } from "../../../logger";
|
import { logger } from "../../../logger";
|
||||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
import { resolveUser, stripObjectToScalars, verboseChannelMention } from "../../../utils";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
|
||||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
import { Permissions, TextChannel } from "discord.js";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||||
|
import { AutoDeletePluginType } from "../types";
|
||||||
|
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||||
|
|
||||||
export async function deleteNextItem(pluginData: GuildPluginData<AutoDeletePluginType>) {
|
export async function deleteNextItem(pluginData: GuildPluginData<AutoDeletePluginType>) {
|
||||||
const [itemToDelete] = pluginData.state.deletionQueue.splice(0, 1);
|
const [itemToDelete] = pluginData.state.deletionQueue.splice(0, 1);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AutoDeletePluginType, MAX_DELAY } from "../types";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
||||||
|
import { AutoDeletePluginType, MAX_DELAY } from "../types";
|
||||||
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue";
|
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue";
|
||||||
|
|
||||||
export async function onMessageCreate(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
export async function onMessageCreate(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutoDeletePluginType } from "../types";
|
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
|
import { AutoDeletePluginType } from "../types";
|
||||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||||
|
|
||||||
export function onMessageDelete(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
export function onMessageDelete(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { AutoDeletePluginType } from "../types";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
|
import { AutoDeletePluginType } from "../types";
|
||||||
import { onMessageDelete } from "./onMessageDelete";
|
import { onMessageDelete } from "./onMessageDelete";
|
||||||
|
|
||||||
export function onMessageDeleteBulk(pluginData: GuildPluginData<AutoDeletePluginType>, messages: SavedMessage[]) {
|
export function onMessageDeleteBulk(pluginData: GuildPluginData<AutoDeletePluginType>, messages: SavedMessage[]) {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
|
||||||
import { AutoReactionsPluginType, ConfigSchema } from "./types";
|
|
||||||
import { PluginOptions } from "knub";
|
import { PluginOptions } from "knub";
|
||||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
|
||||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
|
||||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
|
||||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||||
import { trimPluginDescription } from "../../utils";
|
import { trimPluginDescription } from "../../utils";
|
||||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||||
|
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||||
|
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||||
|
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||||
|
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||||
|
import { AutoReactionsPluginType, ConfigSchema } from "./types";
|
||||||
|
|
||||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||||
config: {
|
config: {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { autoReactionsCmd } from "../types";
|
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
import { autoReactionsCmd } from "../types";
|
||||||
|
|
||||||
export const DisableAutoReactionsCmd = autoReactionsCmd({
|
export const DisableAutoReactionsCmd = autoReactionsCmd({
|
||||||
trigger: "auto_reactions disable",
|
trigger: "auto_reactions disable",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { autoReactionsCmd } from "../types";
|
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
|
||||||
import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils";
|
|
||||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
|
||||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
|
||||||
|
|
||||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
|
||||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
|
||||||
import { GuildChannel, Permissions } from "discord.js";
|
import { GuildChannel, Permissions } from "discord.js";
|
||||||
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
|
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils";
|
||||||
|
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||||
|
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||||
|
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
||||||
|
import { autoReactionsCmd } from "../types";
|
||||||
|
|
||||||
|
|
||||||
const requiredPermissions = readChannelPermissions | Permissions.FLAGS.ADD_REACTIONS;
|
const requiredPermissions = readChannelPermissions | Permissions.FLAGS.ADD_REACTIONS;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { autoReactionsEvt } from "../types";
|
|
||||||
import { isDiscordRESTError } from "../../../utils";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|
||||||
|
|
||||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
|
||||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
|
||||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
|
||||||
import { GuildChannel, Permissions } from "discord.js";
|
import { GuildChannel, Permissions } from "discord.js";
|
||||||
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { isDiscordRESTError } 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";
|
||||||
|
|
||||||
|
|
||||||
const p = Permissions.FLAGS;
|
const p = Permissions.FLAGS;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||||
|
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||||
import { GuildLogs } from "../../data/GuildLogs";
|
import { GuildLogs } from "../../data/GuildLogs";
|
||||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
|
||||||
|
|
||||||
export const ConfigSchema = t.type({
|
export const ConfigSchema = t.type({
|
||||||
can_manage: t.boolean,
|
can_manage: t.boolean,
|
||||||
|
|
|
@ -1,38 +1,35 @@
|
||||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
|
||||||
import { AutomodPluginType, ConfigSchema } from "./types";
|
|
||||||
import { RunAutomodOnJoinEvt } from "./events/RunAutomodOnJoinEvt";
|
|
||||||
import { GuildLogs } from "../../data/GuildLogs";
|
|
||||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
|
||||||
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
|
|
||||||
import { Queue } from "../../Queue";
|
|
||||||
import { configUtils, CooldownManager } from "knub";
|
import { configUtils, CooldownManager } from "knub";
|
||||||
import { availableTriggers } from "./triggers/availableTriggers";
|
|
||||||
import { StrictValidationError } from "../../validatorUtils";
|
|
||||||
import { ConfigPreprocessorFn } from "knub/dist/config/configTypes";
|
import { ConfigPreprocessorFn } from "knub/dist/config/configTypes";
|
||||||
import { availableActions } from "./actions/availableActions";
|
|
||||||
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
|
|
||||||
import { disableCodeBlocks, MINUTES, SECONDS } from "../../utils";
|
|
||||||
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
|
|
||||||
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels";
|
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels";
|
||||||
import { GuildArchives } from "../../data/GuildArchives";
|
import { GuildArchives } from "../../data/GuildArchives";
|
||||||
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges";
|
import { GuildLogs } from "../../data/GuildLogs";
|
||||||
|
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||||
|
import { Queue } from "../../Queue";
|
||||||
|
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||||
|
import { MINUTES, SECONDS } from "../../utils";
|
||||||
|
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
|
||||||
|
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
|
||||||
|
import { StrictValidationError } from "../../validatorUtils";
|
||||||
|
import { CountersPlugin } from "../Counters/CountersPlugin";
|
||||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||||
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin";
|
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin";
|
||||||
import { MutesPlugin } from "../Mutes/MutesPlugin";
|
import { MutesPlugin } from "../Mutes/MutesPlugin";
|
||||||
|
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||||
|
import { availableActions } from "./actions/availableActions";
|
||||||
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
|
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
|
||||||
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd";
|
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd";
|
||||||
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd";
|
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd";
|
||||||
import { pluginInfo } from "./info";
|
|
||||||
import { RegExpRunner } from "../../RegExpRunner";
|
|
||||||
import { LogType } from "../../data/LogType";
|
|
||||||
import { logger } from "../../logger";
|
|
||||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
|
||||||
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
|
|
||||||
import { CountersPlugin } from "../Counters/CountersPlugin";
|
|
||||||
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger";
|
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger";
|
||||||
|
import { RunAutomodOnJoinEvt } from "./events/RunAutomodOnJoinEvt";
|
||||||
|
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
|
||||||
|
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
|
||||||
import { runAutomodOnModAction } from "./events/runAutomodOnModAction";
|
import { runAutomodOnModAction } from "./events/runAutomodOnModAction";
|
||||||
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
|
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges";
|
||||||
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
|
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
|
||||||
|
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
|
||||||
|
import { pluginInfo } from "./info";
|
||||||
|
import { availableTriggers } from "./triggers/availableTriggers";
|
||||||
|
import { AutomodPluginType, ConfigSchema } from "./types";
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
config: {
|
config: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const AddToCounterAction = automodAction({
|
export const AddToCounterAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import * as t from "io-ts";
|
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import {
|
|
||||||
createChunkedMessage,
|
|
||||||
messageLink,
|
|
||||||
stripObjectToScalars,
|
|
||||||
tAllowedMentions,
|
|
||||||
tNormalizedNullOptional,
|
|
||||||
verboseChannelMention,
|
|
||||||
} from "../../../utils";
|
|
||||||
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
|
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|
||||||
import { TextChannel } from "discord.js";
|
import { TextChannel } from "discord.js";
|
||||||
|
import * as t from "io-ts";
|
||||||
import { erisAllowedMentionsToDjsMentionOptions } from "src/utils/erisAllowedMentionsToDjsMentionOptions";
|
import { erisAllowedMentionsToDjsMentionOptions } from "src/utils/erisAllowedMentionsToDjsMentionOptions";
|
||||||
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
|
||||||
|
import {
|
||||||
|
createChunkedMessage,
|
||||||
|
messageLink,
|
||||||
|
stripObjectToScalars,
|
||||||
|
tAllowedMentions,
|
||||||
|
tNormalizedNullOptional,
|
||||||
|
verboseChannelMention
|
||||||
|
} from "../../../utils";
|
||||||
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const AlertAction = automodAction({
|
export const AlertAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { CleanAction } from "./clean";
|
|
||||||
import { AutomodActionBlueprint } from "../helpers";
|
import { AutomodActionBlueprint } from "../helpers";
|
||||||
import { WarnAction } from "./warn";
|
|
||||||
import { MuteAction } from "./mute";
|
|
||||||
import { KickAction } from "./kick";
|
|
||||||
import { BanAction } from "./ban";
|
|
||||||
import { AlertAction } from "./alert";
|
|
||||||
import { ChangeNicknameAction } from "./changeNickname";
|
|
||||||
import { LogAction } from "./log";
|
|
||||||
import { AddRolesAction } from "./addRoles";
|
import { AddRolesAction } from "./addRoles";
|
||||||
import { RemoveRolesAction } from "./removeRoles";
|
|
||||||
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
|
||||||
import { ReplyAction } from "./reply";
|
|
||||||
import { AddToCounterAction } from "./addToCounter";
|
import { AddToCounterAction } from "./addToCounter";
|
||||||
|
import { AlertAction } from "./alert";
|
||||||
|
import { BanAction } from "./ban";
|
||||||
|
import { ChangeNicknameAction } from "./changeNickname";
|
||||||
|
import { CleanAction } from "./clean";
|
||||||
|
import { KickAction } from "./kick";
|
||||||
|
import { LogAction } from "./log";
|
||||||
|
import { MuteAction } from "./mute";
|
||||||
|
import { RemoveRolesAction } from "./removeRoles";
|
||||||
|
import { ReplyAction } from "./reply";
|
||||||
|
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
||||||
import { SetCounterAction } from "./setCounter";
|
import { SetCounterAction } from "./setCounter";
|
||||||
import { SetSlowmodeAction } from "./setSlowmode";
|
import { SetSlowmodeAction } from "./setSlowmode";
|
||||||
|
import { WarnAction } from "./warn";
|
||||||
|
|
||||||
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
|
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
|
||||||
clean: CleanAction,
|
clean: CleanAction,
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import {
|
import {
|
||||||
asyncMap,
|
convertDelayStringToMS,
|
||||||
convertDelayStringToMS,
|
nonNullish,
|
||||||
nonNullish,
|
|
||||||
resolveMember,
|
tDelayString,
|
||||||
tDelayString,
|
tNullable,
|
||||||
tNullable,
|
unique
|
||||||
unique,
|
|
||||||
} from "../../../utils";
|
} from "../../../utils";
|
||||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
|
||||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
|
||||||
import { CaseArgs } from "../../Cases/types";
|
import { CaseArgs } from "../../Cases/types";
|
||||||
|
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||||
|
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const BanAction = automodAction({
|
export const BanAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|
||||||
import { nonNullish, unique } from "../../../utils";
|
import { nonNullish, unique } from "../../../utils";
|
||||||
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const ChangeNicknameAction = automodAction({
|
export const ChangeNicknameAction = automodAction({
|
||||||
configType: t.union([
|
configType: t.union([
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { TextChannel } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { noop } from "../../../utils";
|
import { noop } from "../../../utils";
|
||||||
import { TextChannel } from "discord.js";
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const CleanAction = automodAction({
|
export const CleanAction = automodAction({
|
||||||
configType: t.boolean,
|
configType: t.boolean,
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
|
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
|
||||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
|
||||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
|
||||||
import { CaseArgs } from "../../Cases/types";
|
import { CaseArgs } from "../../Cases/types";
|
||||||
|
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||||
|
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const KickAction = automodAction({
|
export const KickAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { stripObjectToScalars, unique } from "../../../utils";
|
import { stripObjectToScalars, unique } from "../../../utils";
|
||||||
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const LogAction = automodAction({
|
export const LogAction = automodAction({
|
||||||
configType: t.boolean,
|
configType: t.boolean,
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import {
|
|
||||||
asyncMap,
|
|
||||||
convertDelayStringToMS,
|
|
||||||
nonNullish,
|
|
||||||
resolveMember,
|
|
||||||
tDelayString,
|
|
||||||
tNullable,
|
|
||||||
unique,
|
|
||||||
} from "../../../utils";
|
|
||||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
|
||||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
|
||||||
import { MutesPlugin } from "../../Mutes/MutesPlugin";
|
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
import {
|
||||||
|
convertDelayStringToMS,
|
||||||
|
nonNullish,
|
||||||
|
|
||||||
|
tDelayString,
|
||||||
|
tNullable,
|
||||||
|
unique
|
||||||
|
} from "../../../utils";
|
||||||
import { CaseArgs } from "../../Cases/types";
|
import { CaseArgs } from "../../Cases/types";
|
||||||
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
|
import { MutesPlugin } from "../../Mutes/MutesPlugin";
|
||||||
|
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const MuteAction = automodAction({
|
export const MuteAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
import * as t from "io-ts";
|
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
|
|
||||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
|
||||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
|
||||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|
||||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
|
||||||
import { canAssignRole } from "../../../utils/canAssignRole";
|
|
||||||
|
|
||||||
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
|
|
||||||
import { memberRolesLock } from "../../../utils/lockNameHelpers";
|
|
||||||
import { Permissions } from "discord.js";
|
import { Permissions } from "discord.js";
|
||||||
|
import * as t from "io-ts";
|
||||||
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { nonNullish, unique } from "../../../utils";
|
||||||
|
import { canAssignRole } from "../../../utils/canAssignRole";
|
||||||
|
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
||||||
|
import { memberRolesLock } from "../../../utils/lockNameHelpers";
|
||||||
|
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||||
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
|
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
|
|
||||||
const p = Permissions.FLAGS;
|
const p = Permissions.FLAGS;
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
|
import { MessageOptions, Permissions, TextChannel, User } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import {
|
|
||||||
convertDelayStringToMS,
|
|
||||||
noop,
|
|
||||||
renderRecursively,
|
|
||||||
StrictMessageContent,
|
|
||||||
stripObjectToScalars,
|
|
||||||
tDelayString,
|
|
||||||
tMessageContent,
|
|
||||||
tNullable,
|
|
||||||
unique,
|
|
||||||
verboseChannelMention,
|
|
||||||
} from "../../../utils";
|
|
||||||
|
|
||||||
import { AutomodContext } from "../types";
|
|
||||||
import { renderTemplate } from "../../../templateFormatter";
|
|
||||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { TextChannel, User, Constants, MessageOptions, Permissions } from "discord.js";
|
import { renderTemplate } from "../../../templateFormatter";
|
||||||
|
import {
|
||||||
|
convertDelayStringToMS,
|
||||||
|
noop,
|
||||||
|
renderRecursively,
|
||||||
|
|
||||||
|
stripObjectToScalars,
|
||||||
|
tDelayString,
|
||||||
|
tMessageContent,
|
||||||
|
tNullable,
|
||||||
|
unique,
|
||||||
|
verboseChannelMention
|
||||||
|
} from "../../../utils";
|
||||||
|
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
import { AutomodContext } from "../types";
|
||||||
|
|
||||||
|
|
||||||
export const ReplyAction = automodAction({
|
export const ReplyAction = automodAction({
|
||||||
configType: t.union([
|
configType: t.union([
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
|
||||||
import { tNullable } from "../../../utils";
|
import { tNullable } from "../../../utils";
|
||||||
|
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const SetAntiraidLevelAction = automodAction({
|
export const SetAntiraidLevelAction = automodAction({
|
||||||
configType: tNullable(t.string),
|
configType: tNullable(t.string),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const SetCounterAction = automodAction({
|
export const SetCounterAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { TextChannel } from "discord.js";
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { convertDelayStringToMS, isDiscordRESTError, tDelayString, tNullable } from "../../../utils";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import { Constants, TextChannel } from "discord.js";
|
|
||||||
import { ChannelTypeStrings } from "src/types";
|
import { ChannelTypeStrings } from "src/types";
|
||||||
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { convertDelayStringToMS, isDiscordRESTError, tDelayString, tNullable } from "../../../utils";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const SetSlowmodeAction = automodAction({
|
export const SetSlowmodeAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import * as t from "io-ts";
|
import * as t from "io-ts";
|
||||||
import { automodAction } from "../helpers";
|
|
||||||
import { LogType } from "../../../data/LogType";
|
|
||||||
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
|
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
|
||||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
|
||||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
|
||||||
import { CaseArgs } from "../../Cases/types";
|
import { CaseArgs } from "../../Cases/types";
|
||||||
|
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||||
|
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
export const WarnAction = automodAction({
|
export const WarnAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { typedGuildCommand, GuildPluginData } from "knub";
|
import { typedGuildCommand } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
|
||||||
import { sendSuccessMessage } from "../../../pluginUtils";
|
import { sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export const AntiraidClearCmd = typedGuildCommand<AutomodPluginType>()({
|
export const AntiraidClearCmd = typedGuildCommand<AutomodPluginType>()({
|
||||||
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],
|
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { typedGuildCommand, GuildPluginData } from "knub";
|
import { typedGuildCommand } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
|
||||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
|
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export const SetAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
|
export const SetAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
|
||||||
trigger: "antiraid",
|
trigger: "antiraid",
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import { typedGuildCommand, GuildPluginData } from "knub";
|
import { typedGuildCommand } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
import { AutomodPluginType } from "../types";
|
||||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
|
||||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
|
||||||
|
|
||||||
export const ViewAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
|
export const ViewAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
|
||||||
trigger: "antiraid",
|
trigger: "antiraid",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { typedGuildEventListener } from "knub";
|
import { typedGuildEventListener } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import { RecentActionType } from "../constants";
|
import { RecentActionType } from "../constants";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()({
|
export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()({
|
||||||
event: "guildMemberAdd",
|
event: "guildMemberAdd",
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { typedGuildEventListener } from "knub";
|
import { typedGuildEventListener } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { RecentActionType } from "../constants";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import isEqual from "lodash.isequal";
|
|
||||||
import diff from "lodash.difference";
|
import diff from "lodash.difference";
|
||||||
|
import isEqual from "lodash.isequal";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export const RunAutomodOnMemberUpdate = typedGuildEventListener<AutomodPluginType>()({
|
export const RunAutomodOnMemberUpdate = typedGuildEventListener<AutomodPluginType>()({
|
||||||
event: "guildMemberUpdate",
|
event: "guildMemberUpdate",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { GuildPluginData } from "knub";
|
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import { User } from "discord.js";
|
import { User } from "discord.js";
|
||||||
|
import { GuildPluginData } from "knub";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export async function runAutomodOnAntiraidLevel(
|
export async function runAutomodOnAntiraidLevel(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
||||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export async function runAutomodOnCounterTrigger(
|
export async function runAutomodOnCounterTrigger(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
|
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
|
||||||
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage";
|
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function runAutomodOnMessage(
|
export function runAutomodOnMessage(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
|
||||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
||||||
import { ModActionType } from "../../ModActions/types";
|
import { ModActionType } from "../../ModActions/types";
|
||||||
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export async function runAutomodOnModAction(
|
export async function runAutomodOnModAction(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { RECENT_ACTION_EXPIRY_TIME, RecentActionType } from "../constants";
|
|
||||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
|
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
|
||||||
|
import { RecentActionType, RECENT_ACTION_EXPIRY_TIME } from "../constants";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function addRecentActionsFromMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
export function addRecentActionsFromMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||||
const message = context.message!;
|
const message = context.message!;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { AutomodContext, AutomodPluginType, TRule } from "../types";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodTriggerMatchResult } from "../helpers";
|
|
||||||
import { convertDelayStringToMS } from "../../../utils";
|
import { convertDelayStringToMS } from "../../../utils";
|
||||||
|
import { AutomodContext, AutomodPluginType, TRule } from "../types";
|
||||||
|
|
||||||
export function checkAndUpdateCooldown(
|
export function checkAndUpdateCooldown(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
|
import { RECENT_NICKNAME_CHANGE_EXPIRY_TIME } from "../constants";
|
||||||
import { AutomodPluginType } from "../types";
|
import { AutomodPluginType } from "../types";
|
||||||
import { RECENT_NICKNAME_CHANGE_EXPIRY_TIME, RECENT_SPAM_EXPIRY_TIME } from "../constants";
|
|
||||||
|
|
||||||
export function clearOldRecentNicknameChanges(pluginData: GuildPluginData<AutomodPluginType>) {
|
export function clearOldRecentNicknameChanges(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
|
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
|
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { RECENT_SPAM_EXPIRY_TIME } from "../constants";
|
import { RECENT_SPAM_EXPIRY_TIME } from "../constants";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function clearOldRecentSpam(pluginData: GuildPluginData<AutomodPluginType>) {
|
export function clearOldRecentSpam(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { RECENT_ACTION_EXPIRY_TIME, RecentActionType } from "../constants";
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
|
|
||||||
|
|
||||||
export function clearRecentActionsForMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
export function clearRecentActionsForMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||||
const message = context.message!;
|
const message = context.message!;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { RecentActionType } from "../constants";
|
import * as t from "io-ts";
|
||||||
import { automodTrigger } from "../helpers";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
|
import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
||||||
import { getBaseUrl } from "../../../pluginUtils";
|
import { getBaseUrl } from "../../../pluginUtils";
|
||||||
import { convertDelayStringToMS, sorter, tDelayString, tNullable } from "../../../utils";
|
import { convertDelayStringToMS, sorter, tDelayString, tNullable } from "../../../utils";
|
||||||
import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
import { RecentActionType } from "../constants";
|
||||||
|
import { automodTrigger } from "../helpers";
|
||||||
import { findRecentSpam } from "./findRecentSpam";
|
import { findRecentSpam } from "./findRecentSpam";
|
||||||
import { getMatchingMessageRecentActions } from "./getMatchingMessageRecentActions";
|
import { getMatchingMessageRecentActions } from "./getMatchingMessageRecentActions";
|
||||||
import * as t from "io-ts";
|
|
||||||
import { getMessageSpamIdentifier } from "./getSpamIdentifier";
|
import { getMessageSpamIdentifier } from "./getSpamIdentifier";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
|
||||||
|
|
||||||
const MessageSpamTriggerConfig = t.type({
|
const MessageSpamTriggerConfig = t.type({
|
||||||
amount: t.number,
|
amount: t.number,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { RecentActionType } from "../constants";
|
import { RecentActionType } from "../constants";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function findRecentSpam(
|
export function findRecentSpam(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { getMatchingRecentActions } from "./getMatchingRecentActions";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
import { RecentActionType } from "../constants";
|
import { RecentActionType } from "../constants";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
import { getMatchingRecentActions } from "./getMatchingRecentActions";
|
||||||
|
|
||||||
export function getMatchingMessageRecentActions(
|
export function getMatchingMessageRecentActions(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodPluginType } from "../types";
|
|
||||||
import { RecentActionType } from "../constants";
|
import { RecentActionType } from "../constants";
|
||||||
|
import { AutomodPluginType } from "../types";
|
||||||
|
|
||||||
export function getMatchingRecentActions(
|
export function getMatchingRecentActions(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
|
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
|
||||||
import { messageSummary, verboseChannelMention } from "../../../utils";
|
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
|
import { messageSummary, verboseChannelMention } from "../../../utils";
|
||||||
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
|
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
|
||||||
|
|
||||||
export function getTextMatchPartialSummary(
|
export function getTextMatchPartialSummary(
|
||||||
pluginData: GuildPluginData<AutomodPluginType>,
|
pluginData: GuildPluginData<AutomodPluginType>,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue