Skip to content

Commit 66d833e

Browse files
committed
feat: webhook
1 parent 46bad36 commit 66d833e

File tree

14 files changed

+634
-95
lines changed

14 files changed

+634
-95
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "dist/index.js",
66
"type": "module",
77
"scripts": {
8-
"build": "tsc && cp src/ship.png src/ship2.png src/deathbattle.png src/deathbattle2.png src/deathbattle3.png dist/",
8+
"build": "tsc && cp src/webhook.png src/ship.png src/ship2.png src/deathbattle.png src/deathbattle2.png src/deathbattle3.png dist/",
99
"start": "node dist/index.js",
1010
"dev": "tsx src/index.ts",
1111
"watch": "tsc -w",

src/commands/checklink.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ export async function execute(
121121
console.log(
122122
`[CHECKLINK DEBUG] Fandom groups found: ${JSON.stringify(fandomGroups)}`,
123123
);
124-
console.log(
125-
`[CHECKLINK DEBUG] Fandom data status: ${fandomDataStatus}`,
126-
);
124+
console.log(`[CHECKLINK DEBUG] Fandom data status: ${fandomDataStatus}`);
127125

128126
let rolesSynced = false;
129127
let grantedRoleNames: string[] = [];
@@ -219,9 +217,7 @@ export async function execute(
219217
interaction.guild,
220218
);
221219

222-
console.log(
223-
`[CHECKLINK DEBUG] Role mentions generated: ${roleMentions}`,
224-
);
220+
console.log(`[CHECKLINK DEBUG] Role mentions generated: ${roleMentions}`);
225221

226222
embed.addFields({ name: "ROLES SYNCHRONIZED", value: roleMentions });
227223

src/commands/help.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ const commands: CommandInfo[] = [
3636
value: "Sever the link between a Discord soul and a Fandom alter",
3737
category: "admin",
3838
},
39+
{
40+
name: "/webhook >subcommand",
41+
value: "Create webhook for the server",
42+
category: "admin",
43+
},
3944
// Moderator
4045
{
4146
name: "/kick @user [-reason]",

src/commands/link.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,12 @@ export async function execute(
260260
confirmed = true;
261261
collector.stop();
262262

263-
const { grantedRoleNames, failedRoleNames } = await FandomRoleManager.manageFandomRoles(
264-
member,
265-
fandomGroups,
266-
interaction.guild,
267-
);
263+
const { grantedRoleNames, failedRoleNames } =
264+
await FandomRoleManager.manageFandomRoles(
265+
member,
266+
fandomGroups,
267+
interaction.guild,
268+
);
268269
await LinkLogger.addLink(
269270
interaction.user.id,
270271
interaction.user.tag,
@@ -379,4 +380,4 @@ export async function execute(
379380
flags: MessageFlags.Ephemeral,
380381
});
381382
}
382-
}
383+
}

src/commands/sins.ts

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import { ModerationLogger } from "../utils/moderationLogger.js";
1212

1313
export const data = new SlashCommandBuilder()
1414
.setName("sins")
15-
.setDescription("Behold the records of the damned, no parameters shows global sins")
15+
.setDescription(
16+
"Behold the records of the damned, no parameters shows global sins",
17+
)
1618
.addUserOption((option) =>
1719
option
1820
.setName("user")
@@ -72,9 +74,11 @@ export async function execute(
7274
counts.timeout * 3;
7375

7476
// Filter valid entries and reverse to show newest first
75-
const validEntries = userEntries.filter(entry =>
76-
["warn", "kick", "ban", "timeout"].includes(entry.type)
77-
).reverse();
77+
const validEntries = userEntries
78+
.filter((entry) =>
79+
["warn", "kick", "ban", "timeout"].includes(entry.type),
80+
)
81+
.reverse();
7882

7983
const entriesPerPage = 5;
8084
const totalPages = Math.ceil(validEntries.length / entriesPerPage);
@@ -85,13 +89,16 @@ export async function execute(
8589
.setColor("#FFA500")
8690
.setTitle("📋 RECORDS OF THE DAMNED")
8791
.setDescription(
88-
`**${targetUser.tag}'s sins**\n**Total entries:** ${userEntries.length}\n**Sin Score:** ${sinScore} ${sinScore === 1 ? 'point' : 'points'}\n\n**⚠️ Warnings:** ${counts.warn}\n**👢 Kicks:** ${counts.kick}\n**🔨 Bans:** ${counts.ban}\n**🤐 Timeouts:** ${counts.timeout}`,
92+
`**${targetUser.tag}'s sins**\n**Total entries:** ${userEntries.length}\n**Sin Score:** ${sinScore} ${sinScore === 1 ? "point" : "points"}\n\n**⚠️ Warnings:** ${counts.warn}\n**👢 Kicks:** ${counts.kick}\n**🔨 Bans:** ${counts.ban}\n**🤐 Timeouts:** ${counts.timeout}`,
8993
)
9094
.setThumbnail(targetUser.displayAvatarURL())
9195
.setTimestamp();
9296

9397
const startIndex = page * entriesPerPage;
94-
const endIndex = Math.min(startIndex + entriesPerPage, validEntries.length);
98+
const endIndex = Math.min(
99+
startIndex + entriesPerPage,
100+
validEntries.length,
101+
);
95102
const pageEntries = validEntries.slice(startIndex, endIndex);
96103

97104
for (const entry of pageEntries) {
@@ -138,29 +145,28 @@ export async function execute(
138145
};
139146

140147
const createButtons = (page: number) => {
141-
const row = new ActionRowBuilder<ButtonBuilder>()
142-
.addComponents(
143-
new ButtonBuilder()
144-
.setCustomId("first")
145-
.setLabel("⏮️ First")
146-
.setStyle(ButtonStyle.Secondary)
147-
.setDisabled(page === 0),
148-
new ButtonBuilder()
149-
.setCustomId("prev")
150-
.setLabel("◀️ Previous")
151-
.setStyle(ButtonStyle.Secondary)
152-
.setDisabled(page === 0),
153-
new ButtonBuilder()
154-
.setCustomId("next")
155-
.setLabel("▶️ Next")
156-
.setStyle(ButtonStyle.Secondary)
157-
.setDisabled(page === totalPages - 1),
158-
new ButtonBuilder()
159-
.setCustomId("last")
160-
.setLabel("⏭️ Last")
161-
.setStyle(ButtonStyle.Secondary)
162-
.setDisabled(page === totalPages - 1),
163-
);
148+
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(
149+
new ButtonBuilder()
150+
.setCustomId("first")
151+
.setLabel("⏮️ First")
152+
.setStyle(ButtonStyle.Secondary)
153+
.setDisabled(page === 0),
154+
new ButtonBuilder()
155+
.setCustomId("prev")
156+
.setLabel("◀️ Previous")
157+
.setStyle(ButtonStyle.Secondary)
158+
.setDisabled(page === 0),
159+
new ButtonBuilder()
160+
.setCustomId("next")
161+
.setLabel("▶️ Next")
162+
.setStyle(ButtonStyle.Secondary)
163+
.setDisabled(page === totalPages - 1),
164+
new ButtonBuilder()
165+
.setCustomId("last")
166+
.setLabel("⏭️ Last")
167+
.setStyle(ButtonStyle.Secondary)
168+
.setDisabled(page === totalPages - 1),
169+
);
164170
return row;
165171
};
166172

@@ -181,7 +187,8 @@ export async function execute(
181187
collector.on("collect", async (buttonInteraction) => {
182188
if (buttonInteraction.user.id !== interaction.user.id) {
183189
await buttonInteraction.reply({
184-
content: "**ONLY THE INVOKER OF THIS SACRED RITUAL MAY NAVIGATE THE RECORDS!**",
190+
content:
191+
"**ONLY THE INVOKER OF THIS SACRED RITUAL MAY NAVIGATE THE RECORDS!**",
185192
flags: MessageFlags.Ephemeral,
186193
});
187194
return;
@@ -253,7 +260,12 @@ export async function execute(
253260
{
254261
tag: string;
255262
score: number;
256-
counts: { warns: number; kicks: number; bans: number; timeouts: number };
263+
counts: {
264+
warns: number;
265+
kicks: number;
266+
bans: number;
267+
timeouts: number;
268+
};
257269
}
258270
>();
259271

@@ -265,10 +277,10 @@ export async function execute(
265277
entry.type === "warn"
266278
? 1
267279
: entry.type === "kick"
268-
? 5
269-
: entry.type === "ban"
270-
? 10
271-
: 3; // timeout = 3
280+
? 5
281+
: entry.type === "ban"
282+
? 10
283+
: 3; // timeout = 3
272284

273285
if (existing) {
274286
existing.score += points;
@@ -312,12 +324,16 @@ export async function execute(
312324
const userData = sortedUsers[i][1];
313325
const position = `${i + 1}.`;
314326
const breakdown = [];
315-
if (userData.counts.warns > 0) breakdown.push(`${userData.counts.warns}W`);
316-
if (userData.counts.kicks > 0) breakdown.push(`${userData.counts.kicks}K`);
317-
if (userData.counts.bans > 0) breakdown.push(`${userData.counts.bans}B`);
318-
if (userData.counts.timeouts > 0) breakdown.push(`${userData.counts.timeouts}T`);
319-
320-
leaderboard += `${position} **${userData.tag}** - ${userData.score} ${userData.score === 1 ? 'point' : 'points'} (${breakdown.join(", ")})\n`;
327+
if (userData.counts.warns > 0)
328+
breakdown.push(`${userData.counts.warns}W`);
329+
if (userData.counts.kicks > 0)
330+
breakdown.push(`${userData.counts.kicks}K`);
331+
if (userData.counts.bans > 0)
332+
breakdown.push(`${userData.counts.bans}B`);
333+
if (userData.counts.timeouts > 0)
334+
breakdown.push(`${userData.counts.timeouts}T`);
335+
336+
leaderboard += `${position} **${userData.tag}** - ${userData.score} ${userData.score === 1 ? "point" : "points"} (${breakdown.join(", ")})\n`;
321337
}
322338

323339
embed.addFields({

src/commands/synctop5.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { WikiRoleSyncManager } from "../utils/wikiRoleSync.js";
1111

1212
export const data = new SlashCommandBuilder()
1313
.setName("synctop5")
14-
.setDescription("Synchronize the top 5 contributors roles and syncs all roles to the wiki");
14+
.setDescription(
15+
"Synchronize the top 5 contributors roles and syncs all roles to the wiki",
16+
);
1517

1618
export async function execute(
1719
interaction: ChatInputCommandInteraction,
@@ -54,7 +56,11 @@ export async function execute(
5456
);
5557

5658
const embed = new EmbedBuilder()
57-
.setColor(result.errors.length > 0 || !wikiSyncResult.success ? "#FFA500" : "#00FF00")
59+
.setColor(
60+
result.errors.length > 0 || !wikiSyncResult.success
61+
? "#FFA500"
62+
: "#00FF00",
63+
)
5864
.setTitle("🏆 TOP CONTRIBUTORS & WIKI SYNC COMPLETE")
5965
.setDescription(
6066
"**The rankings have been synchronized with the reverent roles!**",

0 commit comments

Comments
 (0)