summaryrefslogtreecommitdiff
path: root/src/discord
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-11 18:13:31 -0700
committerFuwn <[email protected]>2025-09-11 18:13:31 -0700
commit1257d1419d04678296441904a5576464ad86ac27 (patch)
tree244a3759dcdac1dac71e6714b7be9317f2a30d70 /src/discord
parentstyle: Use base prettier:recommended rules (diff)
downloadumabotdiscord-1257d1419d04678296441904a5576464ad86ac27.tar.xz
umabotdiscord-1257d1419d04678296441904a5576464ad86ac27.zip
feat: Add complaint system
Diffstat (limited to 'src/discord')
-rw-r--r--src/discord/commands.ts13
-rw-r--r--src/discord/embeds.ts35
-rw-r--r--src/discord/interfaces.ts24
3 files changed, 67 insertions, 5 deletions
diff --git a/src/discord/commands.ts b/src/discord/commands.ts
index b4436d6..bcf8cba 100644
--- a/src/discord/commands.ts
+++ b/src/discord/commands.ts
@@ -57,3 +57,16 @@ export const TOP_COMMAND: DiscordCommand = {
},
],
};
+
+export const COMPLAIN_COMMAND: DiscordCommand = {
+ name: "complain",
+ description: "Submit a complaint to the moderators",
+ options: [
+ {
+ type: 3,
+ name: "message",
+ description: "Your complaint message",
+ required: true,
+ },
+ ],
+};
diff --git a/src/discord/embeds.ts b/src/discord/embeds.ts
index 1fad102..db23f80 100644
--- a/src/discord/embeds.ts
+++ b/src/discord/embeds.ts
@@ -88,3 +88,38 @@ export const createPostEmbed = (post: RedditPost): DiscordEmbed => {
return embed;
};
+
+export const createComplaintEmbed = (
+ complaintContent: string,
+ complainant: { username: string; id: string; avatar?: string },
+ timestamp: number,
+ isDM: boolean = true,
+): DiscordEmbed => {
+ return {
+ title: "🚨 New Complaint",
+ description: complaintContent,
+ color: 0xff6b6b,
+ fields: [
+ {
+ name: "Complainant",
+ value: `${complainant.username} (${complainant.id})`,
+ inline: true,
+ },
+ {
+ name: "Timestamp",
+ value: `<t:${Math.floor(timestamp / 1000)}:F>`,
+ inline: true,
+ },
+ ],
+ thumbnail: complainant.avatar
+ ? {
+ url: `https://cdn.discordapp.com/avatars/${complainant.id}/${complainant.avatar}.png?size=256`,
+ }
+ : undefined,
+ footer: {
+ text: isDM
+ ? "Complaint submitted via DM"
+ : "Complaint submitted from server",
+ },
+ };
+};
diff --git a/src/discord/interfaces.ts b/src/discord/interfaces.ts
index 3eb81eb..6b26876 100644
--- a/src/discord/interfaces.ts
+++ b/src/discord/interfaces.ts
@@ -17,27 +17,41 @@ export interface DiscordInteraction {
channel?: {
nsfw: boolean;
};
+ guild_id?: string;
+ user?: {
+ id: string;
+ username: string;
+ avatar?: string;
+ };
+ member?: {
+ user?: {
+ id: string;
+ username: string;
+ avatar?: string;
+ };
+ };
}
export interface DiscordEmbed {
title: string;
description: string;
- url: string;
+ url?: string;
color: number;
- author: {
+ author?: {
name: string;
url: string;
};
- fields: Array<{
+ fields?: Array<{
name: string;
value: string;
inline: boolean;
}>;
- timestamp: string;
- footer: {
+ timestamp?: string;
+ footer?: {
text: string;
};
image?: { url: string };
+ thumbnail?: { url: string };
}
export interface DiscordResponse {