Skip to content

Commit fad065d

Browse files
committed
Change configs to using camel case
1 parent 9741033 commit fad065d

47 files changed

Lines changed: 182 additions & 192 deletions

Some content is hidden

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

backend/src/common/schema/message.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ function message<T extends z.ZodType>(stringType: (markdown: boolean) => T) {
1212
return z
1313
.strictObject({
1414
content: stringType(true),
15-
allowed_mentions: z
15+
allowedMentions: z
1616
.strictObject({
1717
everyone: z.boolean(),
18-
replied_user: z.boolean(),
18+
repliedUser: z.boolean(),
1919
users: z.union([z.boolean(), Snowflake.array().max(100)]),
2020
roles: z.union([z.boolean(), Snowflake.array().max(100)]),
2121
})
22-
.partial()
23-
.transform(({ replied_user, ...input }) => ({
24-
repliedUser: replied_user,
25-
...input,
26-
})),
22+
.partial(),
2723
embeds: embed(stringType).array(),
2824
silent: z.boolean(),
2925
})
3026
.partial()
31-
.transform(({ allowed_mentions, silent, ...input }) => ({
32-
allowedMentions: allowed_mentions,
27+
.transform(({ silent, ...input }) => ({
3328
flags: silent ? MessageFlags.SUPPRESS_NOTIFICATIONS : 0,
3429
...input,
3530
}));
@@ -53,16 +48,11 @@ function embed<T extends z.ZodType>(stringType: (markdown: boolean) => T) {
5348
}),
5449
image: stringType(false).transform((url) => ({ url })),
5550
thumbnail: stringType(false).transform((url) => ({ url })),
56-
author: z
57-
.strictObject({
58-
name: stringType(false),
59-
url: stringType(false).optional(),
60-
icon_url: stringType(false).optional(),
61-
})
62-
.transform(({ icon_url, ...input }) => ({
63-
iconURL: icon_url,
64-
...input,
65-
})),
51+
author: z.strictObject({
52+
name: stringType(false),
53+
url: stringType(false).optional(),
54+
iconURL: stringType(false).optional(),
55+
}),
6656
fields: z
6757
.strictObject({
6858
name: stringType(true),

backend/src/common/schema/permissionsFilter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { NumberFilter } from "#common/schema/numberFilter.ts";
33
import { z } from "zod";
44

55
export const PermissionsFilter = z.strictObject({
6-
in_group: z.string().array().optional(),
7-
in_channel: Snowflake.array().optional(),
8-
in_channel_category: Snowflake.array().optional(),
9-
in_thread: Snowflake.array().optional(),
6+
inGroup: z.string().array().optional(),
7+
inChannel: Snowflake.array().optional(),
8+
inChannelCategory: Snowflake.array().optional(),
9+
inThread: Snowflake.array().optional(),
1010
level: NumberFilter.optional(),
1111
});
1212
export type PermissionsFilter = z.output<typeof PermissionsFilter>;

backend/src/plugin/core/command/about.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineCommand({
3737
permissionsGuard(
3838
ctx,
3939
coreConfigStore,
40-
(permissions) => permissions.about_command,
40+
(permissions) => permissions.aboutCommand,
4141
),
4242
async run(ctx) {
4343
const uptime = Math.floor(process.uptime());

backend/src/plugin/core/command/groups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default defineCommand({
2929
permissionsGuard(
3030
ctx,
3131
coreConfigCache,
32-
(permissions) => permissions.groups_command,
32+
(permissions) => permissions.groupsCommand,
3333
),
3434
async run(ctx, args) {
3535
const coreConfig = coreConfigCache.get(ctx.guild.id);

backend/src/plugin/core/command/help/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineCommand({
2828
permissionsGuard(
2929
ctx,
3030
coreConfigStore,
31-
(permissions) => permissions.help_command,
31+
(permissions) => permissions.helpCommand,
3232
),
3333
async run(ctx, args) {
3434
if (args.command !== null) {

backend/src/plugin/core/command/help/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function renderCommandListPage(
114114
entries = [];
115115

116116
const prefix =
117-
coreConfigStore.get(ctx.guild.id)?.prefix_commands.prefix ?? "";
117+
coreConfigStore.get(ctx.guild.id)?.prefixCommands.prefix ?? "";
118118

119119
for (const entry of getCommandsByPlugin(plugin.name) ?? []) {
120120
const { command } = entry;

backend/src/plugin/core/command/help/show.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function renderCommandPage(
2323
container.components.push(Divider());
2424

2525
const prefix =
26-
coreConfigStore.get(guildID)?.prefix_commands.prefix ?? "";
26+
coreConfigStore.get(guildID)?.prefixCommands.prefix ?? "";
2727

2828
let content =
2929
"**Usage:** " +

backend/src/plugin/core/commandEngine/handler/autocompleteHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function handle(
5151
interaction.channel,
5252
);
5353

54-
if (!perms.slash_commands) {
54+
if (!perms.slashCommands) {
5555
return;
5656
}
5757

backend/src/plugin/core/commandEngine/handler/prefixHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async function handle(
103103
return false;
104104
}
105105

106-
const { prefix } = config.prefix_commands;
106+
const { prefix } = config.prefixCommands;
107107

108108
const reader = new StringReader(message.content);
109109

@@ -115,7 +115,7 @@ async function handle(
115115

116116
const perms = resolvePermissions(config, message.member, message.channel);
117117

118-
if (!perms.prefix_commands) {
118+
if (!perms.prefixCommands) {
119119
return false;
120120
}
121121

@@ -286,7 +286,7 @@ class PrefixContext implements CommandContext {
286286
}
287287

288288
const shouldReply =
289-
config.prefix_commands.reply &&
289+
config.prefixCommands.reply &&
290290
this.message.channel
291291
.permissionsOf(this.message.channel.guild.clientMember)
292292
.has(Permissions.READ_MESSAGE_HISTORY);

backend/src/plugin/core/commandEngine/handler/slashHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function handle(
7676
interaction.channel,
7777
);
7878

79-
if (!perms.slash_commands) {
79+
if (!perms.slashCommands) {
8080
return;
8181
}
8282

@@ -92,7 +92,7 @@ async function handle(
9292
const privateOption =
9393
interaction.data.options.getNumber("private") ??
9494
Number(commandEntry.command.ephemeralByDefault);
95-
const ephemeral = perms.ephemeral_response && Boolean(privateOption);
95+
const ephemeral = perms.ephemeralResponse && Boolean(privateOption);
9696
const ctx = new SlashContext(
9797
squirrelCtx,
9898
commandEntry.command,

0 commit comments

Comments
 (0)