@@ -12,7 +12,9 @@ import { ModerationLogger } from "../utils/moderationLogger.js";
1212
1313export 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 ( {
0 commit comments