Skip to content

Commit 3722393

Browse files
committed
chore: run formatter
1 parent 3ef8924 commit 3722393

40 files changed

+13083
-13038
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");
@@ -332,7 +335,7 @@ connect().then(async () => {
332335

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

337340
if (loaded.success_emoji) {
338341
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/triggers/matchInvites.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ const configSchema = z.strictObject({
1515
exclude_guilds: z.array(zSnowflake).max(255).optional(),
1616
include_invite_codes: z.array(z.string().max(32)).max(255).optional(),
1717
exclude_invite_codes: z.array(z.string().max(32)).max(255).optional(),
18-
include_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
19-
exclude_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
18+
include_custom_invite_codes: z
19+
.array(z.string().max(32))
20+
.max(255)
21+
.transform((arr) => arr.map((str) => str.toLowerCase()))
22+
.optional(),
23+
exclude_custom_invite_codes: z
24+
.array(z.string().max(32))
25+
.max(255)
26+
.transform((arr) => arr.map((str) => str.toLowerCase()))
27+
.optional(),
2028
allow_group_dm_invites: z.boolean().default(false),
2129
match_messages: z.boolean().default(true),
2230
match_embeds: z.boolean().default(false),

backend/src/plugins/Automod/triggers/matchLinks.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ export const MatchLinksTrigger = automodTrigger<MatchResultType>()({
7373

7474
if (trigger.exclude_regex) {
7575
if (!regexCache.has(trigger.exclude_regex)) {
76-
const toCache = mergeRegexes(trigger.exclude_regex.map(pattern => inputPatternToRegExp(pattern)), "i");
76+
const toCache = mergeRegexes(
77+
trigger.exclude_regex.map((pattern) => inputPatternToRegExp(pattern)),
78+
"i",
79+
);
7780
regexCache.set(trigger.exclude_regex, toCache);
7881
}
7982
const regexes = regexCache.get(trigger.exclude_regex)!;
@@ -88,7 +91,10 @@ export const MatchLinksTrigger = automodTrigger<MatchResultType>()({
8891

8992
if (trigger.include_regex) {
9093
if (!regexCache.has(trigger.include_regex)) {
91-
const toCache = mergeRegexes(trigger.include_regex.map(pattern => inputPatternToRegExp(pattern)), "i");
94+
const toCache = mergeRegexes(
95+
trigger.include_regex.map((pattern) => inputPatternToRegExp(pattern)),
96+
"i",
97+
);
9298
regexCache.set(trigger.include_regex, toCache);
9399
}
94100
const regexes = regexCache.get(trigger.include_regex)!;

0 commit comments

Comments
 (0)