@@ -85,7 +85,7 @@ const SERVER_EMOJI_MAP = {
8585 "1" : "1️⃣" ,
8686 "2" : "2️⃣" ,
8787 "3" : "3️⃣" ,
88- "4" : "4️⃣"
88+ "4" : "4️⃣" ,
8989} ;
9090
9191const REPO_SERVER_MAP = new Map ( [
@@ -114,7 +114,6 @@ export default async (bot: DiscordBot): Promise<void> => {
114114
115115 let webhook : Discord . Webhook ;
116116 const bridge = await bot . container . getService ( "GameBridge" ) ;
117- const chatWebhook = bridge . discordChatWH ;
118117
119118 bot . discord . on ( "ready" , async ( ) => {
120119 const channel = bot . getTextChannel ( bot . config . channels . publicCommits ) ;
@@ -487,10 +486,21 @@ export default async (bot: DiscordBot): Promise<void> => {
487486 } , new Map < string , string [ ] > ( ) ) ;
488487 }
489488
490- const formatSounds = ( [ folderName , sounds ] ) =>
491- `[**${ folderName } **](https://github.com/Metastruct/garrysmod-chatsounds/tree/master/sound/chatsounds/autoadd/${ folderName } )\n${ [ ...new Set ( sounds ) ] . map ( s => `- \`${ s } \`` ) . join ( "\n" ) } ` ;
489+ const formatSounds = ( [ folderName , sounds ] : [ string , string [ ] ] ) => {
490+ // idk why but I feel like there has to be a better way to do this
491+ // but this seems fine after for now after 3 beer
492+ const soundCount = new Map < string , number > ( ) ;
493+ for ( const sound of sounds ) {
494+ soundCount . set ( sound , ( soundCount . get ( sound ) ?? 0 ) + 1 ) ;
495+ }
496+ const fileName = Array . from ( soundCount , ( [ sound , count ] ) => {
497+ return `- \`${ sound } \`${ count > 1 ? ` x${ count } ` : "" } ` ;
498+ } ) . join ( "\n" ) ;
499+ return `[**${ folderName } **](https://github.com/Metastruct/garrysmod-chatsounds/tree/master/sound/chatsounds/autoadd/${ folderName } )\n${ fileName } ` ;
500+ } ;
492501
493502 async function ChatsoundsPushHandler ( event : EmitterWebhookEvent < "push" > ) {
503+ const chatWebhook = bridge . discordChatWH ;
494504 const payload = event . payload ;
495505 const commits = payload . commits ;
496506
0 commit comments