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

Update djs & knub (#395)

* update pkgs

Signed-off-by: GitHub <noreply@github.com>

* new knub typings

Signed-off-by: GitHub <noreply@github.com>

* more pkg updates

Signed-off-by: GitHub <noreply@github.com>

* more fixes

Signed-off-by: GitHub <noreply@github.com>

* channel typings

Signed-off-by: GitHub <noreply@github.com>

* more message utils typings fixes

Signed-off-by: GitHub <noreply@github.com>

* migrate permissions

Signed-off-by: GitHub <noreply@github.com>

* fix: InternalPoster webhookables

Signed-off-by: GitHub <noreply@github.com>

* djs typings: Attachment & Util

Signed-off-by: GitHub <noreply@github.com>

* more typings

Signed-off-by: GitHub <noreply@github.com>

* fix: rename permissionNames

Signed-off-by: GitHub <noreply@github.com>

* more fixes

Signed-off-by: GitHub <noreply@github.com>

* half the number of errors

* knub commands => messageCommands

Signed-off-by: GitHub <noreply@github.com>

* configPreprocessor => configParser

Signed-off-by: GitHub <noreply@github.com>

* fix channel.messages

Signed-off-by: GitHub <noreply@github.com>

* revert automod any typing

Signed-off-by: GitHub <noreply@github.com>

* more configParser typings

Signed-off-by: GitHub <noreply@github.com>

* revert

Signed-off-by: GitHub <noreply@github.com>

* remove knub type params

Signed-off-by: GitHub <noreply@github.com>

* fix more MessageEmbed / MessageOptions

Signed-off-by: GitHub <noreply@github.com>

* dumb commit for @almeidx to see why this is stupid

Signed-off-by: GitHub <noreply@github.com>

* temp disable custom_events

Signed-off-by: GitHub <noreply@github.com>

* more minor typings fixes - 23 err left

Signed-off-by: GitHub <noreply@github.com>

* update djs dep

* +debug build method (revert this)

Signed-off-by: GitHub <noreply@github.com>

* Revert "+debug build method (revert this)"

This reverts commit a80af1e729.

* Redo +debug build (Revert this)

Signed-off-by: GitHub <noreply@github.com>

* uniform before/after Load shorthands

Signed-off-by: GitHub <noreply@github.com>

* remove unused imports & add prettier plugin

Signed-off-by: GitHub <noreply@github.com>

* env fixes for web platform hosting

Signed-off-by: GitHub <noreply@github.com>

* feat: knub v32-next; related fixes

* fix: allow legacy keys in change_perms action

* fix: request Message Content intent

* fix: use Knub's config validation logic in API

* fix(dashboard): fix error when there are no message and/or slash commands in a plugin

* fix(automod): start_thread action thread options

* fix(CustomEvents): message command types

* chore: remove unneeded type annotation

* feat: add forum channel icon; use thread icon for news threads

* chore: make tslint happy

* chore: fix formatting

---------

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: almeidx <almeidx@pm.me>
Co-authored-by: Dragory <2606411+Dragory@users.noreply.github.com>
This commit is contained in:
Tiago R 2023-04-01 12:58:17 +01:00 committed by GitHub
parent 293115af22
commit 06877e90cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
476 changed files with 2965 additions and 3251 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -1,18 +1,14 @@
import { Guild, Snowflake, User } from "discord.js";
import { Guild, Snowflake } from "discord.js";
import moment from "moment-timezone";
import { isDefaultSticker } from "src/utils/isDefaultSticker";
import { getRepository, Repository } from "typeorm";
import { renderTemplate, TemplateSafeValueContainer } from "../templateFormatter";
import { trimLines } from "../utils";
import { decrypt, encrypt } from "../utils/crypt";
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ArchiveEntry } from "./entities/ArchiveEntry";
import {
channelToTemplateSafeChannel,
guildToTemplateSafeGuild,
userToTemplateSafeUser,
} from "../utils/templateSafeObjects";
import { SavedMessage } from "./entities/SavedMessage";
import { decrypt, encrypt } from "../utils/crypt";
const DEFAULT_EXPIRY_DAYS = 30;

View file

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

View file

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

View file

@ -1,11 +1,5 @@
import { getRepository, Repository } from "typeorm";
import { Reminder } from "./entities/Reminder";
import { BaseRepository } from "./BaseRepository";
import moment from "moment-timezone";
import { DBDateFormat } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { RoleQueueItem } from "./entities/RoleQueueItem";
import { connection } from "./db";
import { RoleButtonsItem } from "./entities/RoleButtonsItem";
export class GuildRoleButtons extends BaseGuildRepository {

View file

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

View file

@ -1,15 +1,13 @@
import { GuildChannel, Message } from "discord.js";
import moment from "moment-timezone";
import { getRepository, Repository } from "typeorm";
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
import { QueuedEventEmitter } from "../QueuedEventEmitter";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
import { buildEntity } from "./buildEntity";
import { noop } from "../utils";
import { decrypt } from "../utils/crypt";
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
import { asyncMap } from "../utils/async";
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { buildEntity } from "./buildEntity";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
export class GuildSavedMessages extends BaseGuildRepository<SavedMessage> {
private messages: Repository<SavedMessage>;
@ -53,13 +51,13 @@ export class GuildSavedMessages extends BaseGuildRepository<SavedMessage> {
title: embed.title,
description: embed.description,
url: embed.url,
timestamp: embed.timestamp,
timestamp: embed.timestamp ? Date.parse(embed.timestamp) : null,
color: embed.color,
fields: embed.fields.map((field) => ({
name: field.name,
value: field.value,
inline: field.inline,
inline: field.inline ?? false,
})),
author: embed.author

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { ApiUserInfo } from "./ApiUserInfo";
import { Column, Entity, PrimaryColumn } from "typeorm";
import { AuditLogEventData, AuditLogEventType } from "../apiAuditLogTypes";
@Entity("api_audit_log")

View file

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

View file

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

View file

@ -1,4 +1,4 @@
import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
@Entity("reminders")
export class Reminder {

View file

@ -1,4 +1,4 @@
import { Snowflake } from "discord.js";
import { Snowflake, StickerFormatType, StickerType } from "discord.js";
import { Column, Entity, PrimaryColumn } from "typeorm";
export interface ISavedMessageAttachmentData {
@ -55,13 +55,13 @@ export interface ISavedMessageEmbedData {
}
export interface ISavedMessageStickerData {
format: string;
format: StickerFormatType;
guildId: Snowflake | null;
id: Snowflake;
name: string;
description: string | null;
available: boolean | null;
type: string | null;
type: StickerType | null;
}
export interface ISavedMessageData {

View file

@ -1,5 +1,5 @@
import { MessageAttachment } from "discord.js";
import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { Attachment } from "discord.js";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { StrictMessageContent } from "../../utils";
@Entity("scheduled_posts")
@ -17,7 +17,7 @@ export class ScheduledPost {
@Column("simple-json") content: StrictMessageContent;
@Column("simple-json") attachments: MessageAttachment[];
@Column("simple-json") attachments: Attachment[];
@Column({ type: String, nullable: true }) post_at: string | null;

View file

@ -1,4 +1,4 @@
import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
@Entity("vc_alerts")
export class VCAlert {

View file

@ -2,7 +2,6 @@
import { lazyMemoize, MINUTES } from "../../utils";
import { Archives } from "../Archives";
import moment from "moment-timezone";
const LOOP_INTERVAL = 15 * MINUTES;
const getArchivesRepository = lazyMemoize(() => new Archives());

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
// tslint:disable:no-console
import { HOURS, MINUTES } from "../../utils";
import { MINUTES } from "../../utils";
import {
deleteStalePhishermanCacheEntries,
deleteStalePhishermanKeyCacheEntries,

View file

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

View file

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

View file

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