Skip to content

Commit e642737

Browse files
committed
Seemingly functionaly o11y
1 parent a0cf9ee commit e642737

File tree

12 files changed

+211
-252
lines changed

12 files changed

+211
-252
lines changed

app/commands/force-ban.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import { ApplicationCommandType } from "discord-api-types/v10";
55
import { log, trackPerformance } from "#~/helpers/observability";
66
import { commandStats } from "#~/helpers/metrics";
77

8-
export const command = new ContextMenuCommandBuilder()
8+
const command = new ContextMenuCommandBuilder()
99
.setName("Force Ban")
1010
.setType(ApplicationCommandType.User)
1111
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers);
1212

13-
export const handler = async (
14-
interaction: UserContextMenuCommandInteraction,
15-
) => {
13+
const handler = async (interaction: UserContextMenuCommandInteraction) => {
1614
await trackPerformance(
1715
"forceBanCommand",
1816
async () => {
@@ -91,3 +89,5 @@ export const handler = async (
9189
},
9290
);
9391
};
92+
93+
export const Command = { handler, command };

app/commands/report.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import { ReportReasons } from "./track/reportCache";
66
import { log, trackPerformance } from "#~/helpers/observability";
77
import { commandStats } from "#~/helpers/metrics";
88

9-
export const command = new ContextMenuCommandBuilder()
9+
const command = new ContextMenuCommandBuilder()
1010
.setName("Report")
1111
.setType(ApplicationCommandType.Message)
1212
.setDefaultMemberPermissions(PermissionFlagsBits.SendMessages);
1313

14-
export const handler = async (
15-
interaction: MessageContextMenuCommandInteraction,
16-
) => {
14+
const handler = async (interaction: MessageContextMenuCommandInteraction) => {
1715
await trackPerformance(
1816
"reportCommand",
1917
async () => {
@@ -84,3 +82,5 @@ export const handler = async (
8482
},
8583
);
8684
};
85+
86+
export const Command = { handler, command };

app/commands/setup.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import { SETTINGS, setSettings, registerGuild } from "#~/models/guilds.server";
55
import { log, trackPerformance } from "#~/helpers/observability";
66
import { commandStats } from "#~/helpers/metrics";
77

8-
export const command = new SlashCommandBuilder()
8+
const command = new SlashCommandBuilder()
99
.setName("setup")
1010
.setDescription("Set up necessities for using the bot")
1111
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
12-
// TODO: update permissions so non-mods can never use it
13-
// maybe implement as "adder must init immediately"?
14-
// .setDefaultPermission(true);
1512
.addRoleOption((x) =>
1613
x
1714
.setName("moderator")
@@ -32,7 +29,7 @@ export const command = new SlashCommandBuilder()
3229
),
3330
) as SlashCommandBuilder;
3431

35-
export const handler = async (interaction: ChatInputCommandInteraction) => {
32+
const handler = async (interaction: ChatInputCommandInteraction) => {
3633
await trackPerformance(
3734
"setupCommand",
3835
async () => {
@@ -108,3 +105,5 @@ ${error.toString()}
108105
},
109106
);
110107
};
108+
109+
export const Command = { handler, command };

app/commands/setupTickets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const rest = new REST({ version: "10" }).setToken(discordToken);
3131

3232
const DEFAULT_BUTTON_TEXT = "Open a private ticket with the moderators";
3333

34-
export default [
34+
export const Command = [
3535
{
3636
command: new SlashCommandBuilder()
3737
.setName("tickets-channel")

app/commands/track.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import { reacord } from "#~/discord/client.server";
77
import { reportUser } from "#~/helpers/modLog";
88
import { ReportReasons } from "#~/commands/track/reportCache";
99

10-
export const command = new ContextMenuCommandBuilder()
10+
const command = new ContextMenuCommandBuilder()
1111
.setName("Track")
1212
.setType(ApplicationCommandType.Message)
1313
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages);
1414

15-
export const handler = async (
16-
interaction: MessageContextMenuCommandInteraction,
17-
) => {
15+
const handler = async (interaction: MessageContextMenuCommandInteraction) => {
1816
const { targetMessage: message, user } = interaction;
1917

2018
const reportPromise = reportUser({
@@ -49,3 +47,5 @@ export const handler = async (
4947
</>,
5048
);
5149
};
50+
51+
export const Command = { handler, command };

0 commit comments

Comments
 (0)