3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

chore: format repo (#482)

Begone formatting errors
This commit is contained in:
rubyowo 2024-06-02 15:21:27 +00:00 committed by GitHub
parent 8a4f7fe0e8
commit 914efb6fcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 95 additions and 41 deletions

View file

@ -44,7 +44,15 @@ import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availab
import { setProfiler } from "./profiler.js"; import { setProfiler } from "./profiler.js";
import { logRateLimit } from "./rateLimitStats.js"; import { logRateLimit } from "./rateLimitStats.js";
import { startUptimeCounter } from "./uptime.js"; import { startUptimeCounter } from "./uptime.js";
import { MINUTES, SECONDS, errorMessage, isDiscordAPIError, isDiscordHTTPError, sleep, successMessage } from "./utils.js"; import {
MINUTES,
SECONDS,
errorMessage,
isDiscordAPIError,
isDiscordHTTPError,
sleep,
successMessage,
} from "./utils.js";
import { DecayingCounter } from "./utils/DecayingCounter.js"; import { DecayingCounter } from "./utils/DecayingCounter.js";
import { enableProfiling } from "./utils/easyProfiler.js"; import { enableProfiling } from "./utils/easyProfiler.js";
import { loadYamlSafely } from "./utils/loadYamlSafely.js"; import { loadYamlSafely } from "./utils/loadYamlSafely.js";

View file

@ -3,18 +3,24 @@ import { MigrationInterface, QueryRunner, Table, TableColumn } from "typeorm";
export class MoveStarboardsToConfig1573248462469 implements MigrationInterface { export class MoveStarboardsToConfig1573248462469 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> { public async up(queryRunner: QueryRunner): Promise<any> {
// Create a new column for the channel's id // Create a new column for the channel's id
await queryRunner.addColumn("starboard_messages", new TableColumn({ await queryRunner.addColumn(
"starboard_messages",
new TableColumn({
name: "starboard_channel_id", name: "starboard_channel_id",
type: "bigint", type: "bigint",
unsigned: true, unsigned: true,
})); }),
);
// Since we are removing the guild_id with the starboards table, we might want it here // Since we are removing the guild_id with the starboards table, we might want it here
await queryRunner.addColumn("starboard_messages", new TableColumn({ await queryRunner.addColumn(
"starboard_messages",
new TableColumn({
name: "guild_id", name: "guild_id",
type: "bigint", type: "bigint",
unsigned: true, unsigned: true,
})); }),
);
// Migrate the old starboard_id to the new starboard_channel_id // Migrate the old starboard_id to the new starboard_channel_id
await queryRunner.query(` await queryRunner.query(`
@ -43,11 +49,14 @@ export class MoveStarboardsToConfig1573248462469 implements MigrationInterface {
await queryRunner.dropColumn("starboard_messages", "starboard_channel_id"); await queryRunner.dropColumn("starboard_messages", "starboard_channel_id");
await queryRunner.dropColumn("starboard_messages", "guild_id"); await queryRunner.dropColumn("starboard_messages", "guild_id");
await queryRunner.addColumn("starboard_messages", new TableColumn({ await queryRunner.addColumn(
"starboard_messages",
new TableColumn({
name: "starboard_id", name: "starboard_id",
type: "int", type: "int",
unsigned: true, unsigned: true,
})); }),
);
await queryRunner.query(` await queryRunner.query(`
ALTER TABLE starboard_messages ALTER TABLE starboard_messages

View file

@ -1,5 +1,4 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import { MigrationInterface, QueryRunner, TableForeignKey } from "typeorm";
import { TableForeignKey } from "typeorm";
export class AddCaseNotesForeignKey1596994103885 implements MigrationInterface { export class AddCaseNotesForeignKey1596994103885 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> { public async up(queryRunner: QueryRunner): Promise<any> {

View file

@ -1,5 +1,4 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
import { TableColumn } from "typeorm";
export class AddLogMessageIdToCases1597015567215 implements MigrationInterface { export class AddLogMessageIdToCases1597015567215 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> { public async up(queryRunner: QueryRunner): Promise<any> {

View file

@ -1,5 +1,4 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import { MigrationInterface, QueryRunner, Table } from "typeorm";
import { Table } from "typeorm";
export class CreateMemberTimezonesTable1597109357201 implements MigrationInterface { export class CreateMemberTimezonesTable1597109357201 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> { public async up(queryRunner: QueryRunner): Promise<any> {

View file

@ -1,5 +1,4 @@
import { MigrationInterface, QueryRunner, TableColumn, TableIndex } from "typeorm"; import { MigrationInterface, QueryRunner, TableColumn, TableForeignKey, TableIndex } from "typeorm";
import { TableForeignKey } from "typeorm";
export class UpdateCounterTriggers1617363975046 implements MigrationInterface { export class UpdateCounterTriggers1617363975046 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> { public async up(queryRunner: QueryRunner): Promise<void> {

View file

@ -1,11 +1,17 @@
import { Embed, Invite } from "discord.js"; import { Invite } from "discord.js";
import escapeStringRegexp from "escape-string-regexp"; import escapeStringRegexp from "escape-string-regexp";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import cloneDeep from "lodash/cloneDeep.js"; import cloneDeep from "lodash/cloneDeep.js";
import { allowTimeout } from "../../../RegExpRunner.js"; import { allowTimeout } from "../../../RegExpRunner.js";
import { ZalgoRegex } from "../../../data/Zalgo.js"; import { ZalgoRegex } from "../../../data/Zalgo.js";
import { ISavedMessageEmbedData, SavedMessage } from "../../../data/entities/SavedMessage.js"; import { ISavedMessageEmbedData, SavedMessage } from "../../../data/entities/SavedMessage.js";
import { getInviteCodesInString, getUrlsInString, isGuildInvite, resolveInvite, resolveMember } from "../../../utils.js"; import {
getInviteCodesInString,
getUrlsInString,
isGuildInvite,
resolveInvite,
resolveMember,
} from "../../../utils.js";
import { CensorPluginType } from "../types.js"; import { CensorPluginType } from "../types.js";
import { censorMessage } from "./censorMessage.js"; import { censorMessage } from "./censorMessage.js";

View file

@ -1,7 +1,7 @@
import { BasePluginType } from "knub"; import { BasePluginType } from "knub";
import { z } from "zod";
import { Configs } from "../../data/Configs.js"; import { Configs } from "../../data/Configs.js";
import Timeout = NodeJS.Timeout; import Timeout = NodeJS.Timeout;
import { z } from "zod";
export const zGuildConfigReloaderPlugin = z.strictObject({}); export const zGuildConfigReloaderPlugin = z.strictObject({});

View file

@ -1,6 +1,6 @@
import { BasePluginType } from "knub"; import { BasePluginType } from "knub";
import { GuildMemberCache } from "../../data/GuildMemberCache.js";
import { z } from "zod"; import { z } from "zod";
import { GuildMemberCache } from "../../data/GuildMemberCache.js";
export const zGuildMemberCacheConfig = z.strictObject({}); export const zGuildMemberCacheConfig = z.strictObject({});

View file

@ -1,8 +1,8 @@
import { WebhookClient } from "discord.js"; import { WebhookClient } from "discord.js";
import { BasePluginType } from "knub"; import { BasePluginType } from "knub";
import { z } from "zod";
import { Queue } from "../../Queue.js"; import { Queue } from "../../Queue.js";
import { Webhooks } from "../../data/Webhooks.js"; import { Webhooks } from "../../data/Webhooks.js";
import { z } from "zod";
export const zInternalPosterConfig = z.strictObject({}); export const zInternalPosterConfig = z.strictObject({});

View file

@ -30,7 +30,7 @@ import {
import { LogsThreadCreateEvt, LogsThreadDeleteEvt, LogsThreadUpdateEvt } from "./events/LogsThreadModifyEvts.js"; import { LogsThreadCreateEvt, LogsThreadDeleteEvt, LogsThreadUpdateEvt } from "./events/LogsThreadModifyEvts.js";
import { LogsGuildMemberUpdateEvt } from "./events/LogsUserUpdateEvts.js"; import { LogsGuildMemberUpdateEvt } from "./events/LogsUserUpdateEvts.js";
import { LogsVoiceStateUpdateEvt } from "./events/LogsVoiceChannelEvts.js"; import { LogsVoiceStateUpdateEvt } from "./events/LogsVoiceChannelEvts.js";
import { FORMAT_NO_TIMESTAMP, LogsPluginType, zLogsConfig } from "./types.js"; import { LogsPluginType, zLogsConfig } from "./types.js";
import { getLogMessage } from "./util/getLogMessage.js"; import { getLogMessage } from "./util/getLogMessage.js";
import { log } from "./util/log.js"; import { log } from "./util/log.js";
import { onMessageDelete } from "./util/onMessageDelete.js"; import { onMessageDelete } from "./util/onMessageDelete.js";

View file

@ -12,7 +12,7 @@ import {
userToTemplateSafeUser, userToTemplateSafeUser,
} from "../../../utils/templateSafeObjects.js"; } from "../../../utils/templateSafeObjects.js";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
import { FORMAT_NO_TIMESTAMP, LogsPluginType } from "../types.js"; import { LogsPluginType } from "../types.js";
import { log } from "../util/log.js"; import { log } from "../util/log.js";
export interface LogMessageDeleteData { export interface LogMessageDeleteData {

View file

@ -6,7 +6,7 @@ import { GuildCases } from "../../data/GuildCases.js";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
import { LogType } from "../../data/LogType.js"; import { LogType } from "../../data/LogType.js";
import { keys, zBoundedCharacters, zMessageContent, zRegex, zSnowflake } from "../../utils.js"; import { zBoundedCharacters, zMessageContent, zRegex, zSnowflake } from "../../utils.js";
import { MessageBuffer } from "../../utils/MessageBuffer.js"; import { MessageBuffer } from "../../utils/MessageBuffer.js";
import { import {
TemplateSafeCase, TemplateSafeCase,

View file

@ -25,7 +25,7 @@ import {
TemplateSafeUser, TemplateSafeUser,
} from "../../../utils/templateSafeObjects.js"; } from "../../../utils/templateSafeObjects.js";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
import { FORMAT_NO_TIMESTAMP, ILogTypeData, LogsPluginType, TLogChannel } from "../types.js"; import { ILogTypeData, LogsPluginType, TLogChannel } from "../types.js";
export async function getLogMessage<TLogType extends keyof ILogTypeData>( export async function getLogMessage<TLogType extends keyof ILogTypeData>(
pluginData: GuildPluginData<LogsPluginType>, pluginData: GuildPluginData<LogsPluginType>,

View file

@ -2,7 +2,12 @@ import { PluginOptions, guildPlugin } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB.js"; import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB.js";
import { SavePinsToDBCmd } from "./commands/SavePinsToDB.js"; import { SavePinsToDBCmd } from "./commands/SavePinsToDB.js";
import { MessageCreateEvt, MessageDeleteBulkEvt, MessageDeleteEvt, MessageUpdateEvt } from "./events/SaveMessagesEvts.js"; import {
MessageCreateEvt,
MessageDeleteBulkEvt,
MessageDeleteEvt,
MessageUpdateEvt,
} from "./events/SaveMessagesEvts.js";
import { MessageSaverPluginType, zMessageSaverConfig } from "./types.js"; import { MessageSaverPluginType, zMessageSaverConfig } from "./types.js";
const defaultOptions: PluginOptions<MessageSaverPluginType> = { const defaultOptions: PluginOptions<MessageSaverPluginType> = {

View file

@ -3,7 +3,14 @@ import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { CaseTypes } from "../../../data/CaseTypes.js"; import { CaseTypes } from "../../../data/CaseTypes.js";
import { sendErrorMessage } from "../../../pluginUtils.js"; import { sendErrorMessage } from "../../../pluginUtils.js";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin.js"; import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin.js";
import { UnknownUser, chunkArray, emptyEmbedValue, renderUsername, resolveMember, resolveUser } from "../../../utils.js"; import {
UnknownUser,
chunkArray,
emptyEmbedValue,
renderUsername,
resolveMember,
resolveUser,
} from "../../../utils.js";
import { asyncMap } from "../../../utils/async.js"; import { asyncMap } from "../../../utils/async.js";
import { createPaginatedMessage } from "../../../utils/createPaginatedMessage.js"; import { createPaginatedMessage } from "../../../utils/createPaginatedMessage.js";
import { getGuildPrefix } from "../../../utils/getGuildPrefix.js"; import { getGuildPrefix } from "../../../utils/getGuildPrefix.js";

View file

@ -3,7 +3,13 @@ import { GuildPluginData } from "knub";
import { CaseTypes } from "../../../data/CaseTypes.js"; import { CaseTypes } from "../../../data/CaseTypes.js";
import { LogType } from "../../../data/LogType.js"; import { LogType } from "../../../data/LogType.js";
import { renderTemplate, TemplateParseError, TemplateSafeValueContainer } from "../../../templateFormatter.js"; import { renderTemplate, TemplateParseError, TemplateSafeValueContainer } from "../../../templateFormatter.js";
import { createUserNotificationError, notifyUser, resolveUser, ucfirst, UserNotificationResult } from "../../../utils.js"; import {
createUserNotificationError,
notifyUser,
resolveUser,
ucfirst,
UserNotificationResult,
} from "../../../utils.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js"; import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
import { CasesPlugin } from "../../Cases/CasesPlugin.js"; import { CasesPlugin } from "../../Cases/CasesPlugin.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js"; import { LogsPlugin } from "../../Logs/LogsPlugin.js";

View file

@ -2,7 +2,13 @@ import { GuildMember, Snowflake } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { CaseTypes } from "../../../data/CaseTypes.js"; import { CaseTypes } from "../../../data/CaseTypes.js";
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter.js"; import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter.js";
import { UserNotificationResult, createUserNotificationError, notifyUser, resolveUser, ucfirst } from "../../../utils.js"; import {
UserNotificationResult,
createUserNotificationError,
notifyUser,
resolveUser,
ucfirst,
} from "../../../utils.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js"; import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
import { waitForButtonConfirm } from "../../../utils/waitForInteraction.js"; import { waitForButtonConfirm } from "../../../utils/waitForInteraction.js";
import { CasesPlugin } from "../../Cases/CasesPlugin.js"; import { CasesPlugin } from "../../Cases/CasesPlugin.js";

View file

@ -1,5 +1,9 @@
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { getPhishermanDomainInfo, phishermanDomainIsSafe, trackPhishermanCaughtDomain } from "../../../data/Phisherman.js"; import {
getPhishermanDomainInfo,
phishermanDomainIsSafe,
trackPhishermanCaughtDomain,
} from "../../../data/Phisherman.js";
import { PhishermanDomainInfo } from "../../../data/types/phisherman.js"; import { PhishermanDomainInfo } from "../../../data/types/phisherman.js";
import { PhishermanPluginType } from "../types.js"; import { PhishermanPluginType } from "../types.js";

View file

@ -1,5 +1,10 @@
import test from "ava"; import test from "ava";
import { parseTemplate, renderParsedTemplate, renderTemplate, TemplateSafeValueContainer } from "./templateFormatter.js"; import {
parseTemplate,
renderParsedTemplate,
renderTemplate,
TemplateSafeValueContainer,
} from "./templateFormatter.js";
test("Parses plain string templates correctly", (t) => { test("Parses plain string templates correctly", (t) => {
const result = parseTemplate("foo bar baz"); const result = parseTemplate("foo bar baz");

View file

@ -286,8 +286,10 @@ export type StrictMessageContent = {
}; };
export type MessageContent = string | StrictMessageContent; export type MessageContent = string | StrictMessageContent;
export const zMessageContent = z.union([zBoundedCharacters(0, 4000), zStrictMessageContent]) as z.ZodType<MessageContent>; export const zMessageContent = z.union([
zBoundedCharacters(0, 4000),
zStrictMessageContent,
]) as z.ZodType<MessageContent>;
export function validateAndParseMessageContent(input: unknown): StrictMessageContent { export function validateAndParseMessageContent(input: unknown): StrictMessageContent {
if (input == null) { if (input == null) {