Skip to content

Commit 8b6cf4b

Browse files
committed
chore: run formatter
1 parent 3372ac2 commit 8b6cf4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+13094
-13043
lines changed

backend/src/RegExpRunner.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ const isTimeoutError = (a): a is TimeoutError => {
99
};
1010

1111
export class RegExpTimeoutError extends Error {
12-
constructor(message: string, public elapsedTimeMs: number) {
12+
constructor(
13+
message: string,
14+
public elapsedTimeMs: number,
15+
) {
1316
super(message);
1417
}
1518
}

backend/src/api/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import express from "express";
22
import z from "zod/v4";
3+
import { $ZodPipeDef } from "zod/v4/core";
34
import { availableGuildPlugins } from "../plugins/availablePlugins.js";
45
import { ZeppelinGuildPluginInfo } from "../types.js";
56
import { indentLines } from "../utils.js";
67
import { notFound } from "./responses.js";
7-
import { $ZodPipeDef } from "zod/v4/core";
88

99
function isZodObject(schema: z.ZodType): schema is z.ZodObject<any> {
1010
return schema.def.type === "object";

backend/src/configValidator.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ export async function validateGuildConfig(config: any): Promise<string | null> {
2828
}
2929

3030
const plugin = pluginNameToPlugin.get(pluginName)!;
31-
const configManager = new PluginConfigManager(
32-
pluginOptions,
33-
{
34-
configSchema: plugin.configSchema,
35-
defaultOverrides: plugin.defaultOverrides ?? [],
36-
levels: {},
37-
customOverrideCriteriaFunctions: plugin.customOverrideCriteriaFunctions,
38-
},
39-
);
31+
const configManager = new PluginConfigManager(pluginOptions, {
32+
configSchema: plugin.configSchema,
33+
defaultOverrides: plugin.defaultOverrides ?? [],
34+
levels: {},
35+
customOverrideCriteriaFunctions: plugin.customOverrideCriteriaFunctions,
36+
});
4037

4138
try {
4239
await configManager.init();

backend/src/data/FishFish.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ async function getSessionToken(): Promise<string> {
5959
}
6060

6161
const timeUntilExpiry = Date.now() - parseResult.data.expires * 1000;
62-
setTimeout(() => {
63-
sessionTokenPromise = null;
64-
}, timeUntilExpiry - 1 * MINUTES); // Subtract a minute to ensure we refresh before expiry
62+
setTimeout(
63+
() => {
64+
sessionTokenPromise = null;
65+
},
66+
timeUntilExpiry - 1 * MINUTES,
67+
); // Subtract a minute to ensure we refresh before expiry
6568

6669
return parseResult.data.token;
6770
})();

backend/src/data/GuildLogs.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ export class GuildLogs extends events.EventEmitter {
4040
this.ignoredLogs.push({ type, ignoreId });
4141

4242
// Clear after expiry (15sec by default)
43-
setTimeout(() => {
44-
this.clearIgnoredLog(type, ignoreId);
45-
}, timeout || 1000 * 15);
43+
setTimeout(
44+
() => {
45+
this.clearIgnoredLog(type, ignoreId);
46+
},
47+
timeout || 1000 * 15,
48+
);
4649
}
4750

4851
isLogIgnored(type: keyof typeof LogType, ignoreId: any) {

backend/src/exportSchemas.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,24 @@ const basePluginOverrideCriteriaSchema = z.strictObject({
3434
extra: z.any().optional(),
3535
});
3636

37-
const pluginOverrideCriteriaSchema = basePluginOverrideCriteriaSchema.extend({
38-
get zzz_dummy_property_do_not_use() {
39-
return pluginOverrideCriteriaSchema.optional();
40-
},
41-
get all() {
42-
return z.array(pluginOverrideCriteriaSchema).optional();
43-
},
44-
get any() {
45-
return z.array(pluginOverrideCriteriaSchema).optional();
46-
},
47-
get not() {
48-
return pluginOverrideCriteriaSchema.optional();
49-
},
50-
}).meta({
51-
id: "overrideCriteria",
52-
});
37+
const pluginOverrideCriteriaSchema = basePluginOverrideCriteriaSchema
38+
.extend({
39+
get zzz_dummy_property_do_not_use() {
40+
return pluginOverrideCriteriaSchema.optional();
41+
},
42+
get all() {
43+
return z.array(pluginOverrideCriteriaSchema).optional();
44+
},
45+
get any() {
46+
return z.array(pluginOverrideCriteriaSchema).optional();
47+
},
48+
get not() {
49+
return pluginOverrideCriteriaSchema.optional();
50+
},
51+
})
52+
.meta({
53+
id: "overrideCriteria",
54+
});
5355

5456
const outputPath = process.argv[2];
5557
if (!outputPath) {

backend/src/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,17 @@ setInterval(() => {
199199
avgCount++;
200200
lastCheck = now;
201201
}, 500);
202-
setInterval(() => {
203-
const avgBlocking = avgTotal / (avgCount || 1);
204-
// FIXME: Debug
205-
// tslint:disable-next-line:no-console
206-
console.log(`Average blocking in the last 5min: ${avgBlocking / avgTotal}ms`);
207-
avgTotal = 0;
208-
avgCount = 0;
209-
}, 5 * 60 * 1000);
202+
setInterval(
203+
() => {
204+
const avgBlocking = avgTotal / (avgCount || 1);
205+
// FIXME: Debug
206+
// tslint:disable-next-line:no-console
207+
console.log(`Average blocking in the last 5min: ${avgBlocking / avgTotal}ms`);
208+
avgTotal = 0;
209+
avgCount = 0;
210+
},
211+
5 * 60 * 1000,
212+
);
210213

211214
if (env.DEBUG) {
212215
logger.info("NOTE: Bot started in DEBUG mode");
@@ -335,7 +338,7 @@ connect().then(async () => {
335338

336339
if (loaded.success_emoji || loaded.error_emoji) {
337340
const deprecatedKeys = [] as string[];
338-
const exampleConfig = `plugins:\n common:\n config:\n success_emoji: "👍"\n error_emoji: "👎"`;
341+
// const exampleConfig = `plugins:\n common:\n config:\n success_emoji: "👍"\n error_emoji: "👎"`;
339342

340343
if (loaded.success_emoji) {
341344
deprecatedKeys.push("success_emoji");

backend/src/plugins/Automod/actions/changePerms.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ const permissionNames = keys(PermissionsBitField.Flags) as U.ListOf<keyof typeof
6565
const legacyPermissionNames = keys(legacyPermMap) as U.ListOf<keyof typeof legacyPermMap>;
6666
const allPermissionNames = [...permissionNames, ...legacyPermissionNames] as const;
6767

68-
const permissionTypeMap = allPermissionNames.reduce((map, permName) => {
69-
map[permName] = z.boolean().nullable();
70-
return map;
71-
}, {} as Record<typeof allPermissionNames[number], z.ZodNullable<z.ZodBoolean>>);
68+
const permissionTypeMap = allPermissionNames.reduce(
69+
(map, permName) => {
70+
map[permName] = z.boolean().nullable();
71+
return map;
72+
},
73+
{} as Record<(typeof allPermissionNames)[number], z.ZodNullable<z.ZodBoolean>>,
74+
);
7275
const zPermissionsMap = z.strictObject(permissionTypeMap);
7376

7477
export const ChangePermsAction = automodAction({

backend/src/plugins/Automod/commands/DebugAutomodCmd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getOrFetchUser } from "../../../utils/getOrFetchUser.js";
1010
export const DebugAutomodCmd = guildPluginMessageCommand<AutomodPluginType>()({
1111
trigger: "debug_automod",
1212
permission: "can_debug_automod",
13-
13+
1414
signature: {
1515
messageId: ct.string(),
1616
},

backend/src/plugins/Automod/functions/runAutomod.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface RuleResultOutcomeSuccess {
3232

3333
interface RuleResultOutcomeFailure {
3434
success: false;
35-
reason: typeof ruleFailReason[keyof typeof ruleFailReason];
35+
reason: (typeof ruleFailReason)[keyof typeof ruleFailReason];
3636
}
3737

3838
type RuleResultOutcome = RuleResultOutcomeSuccess | RuleResultOutcomeFailure;
@@ -48,7 +48,11 @@ interface AutomodRunResult {
4848
rulesChecked: RuleResult[];
4949
}
5050

51-
export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext, dryRun: boolean = false): Promise<AutomodRunResult> {
51+
export async function runAutomod(
52+
pluginData: GuildPluginData<AutomodPluginType>,
53+
context: AutomodContext,
54+
dryRun = false,
55+
): Promise<AutomodRunResult> {
5256
const userId = context.user?.id || context.member?.id || context.message?.user_id;
5357
const user = context.user || (userId && pluginData.client.users!.cache.get(userId as Snowflake));
5458
const member = context.member || (userId && pluginData.guild.members.cache.get(userId as Snowflake)) || null;

0 commit comments

Comments
 (0)