File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -652,9 +652,13 @@ export default {
652652 t . players . map ( ( u ) => u . user_id ) ,
653653 )
654654
655- async function cancel ( interaction : any , matchId : number ) {
655+ async function cancel (
656+ interaction : any ,
657+ matchId : number ,
658+ log : boolean = false ,
659+ ) {
656660 try {
657- if ( interaction . message ) {
661+ if ( interaction . message && ! log ) {
658662 await interaction
659663 . update ( {
660664 content : 'The match has been cancelled.' ,
@@ -681,6 +685,11 @@ export default {
681685 await cancel ( interaction , matchId )
682686 }
683687
688+ // Check if log channel is the channel
689+ if ( interaction . channel ! . id == botSettings . queue_logs_channel_id ) {
690+ await cancel ( interaction , matchId , true )
691+ }
692+
684693 // Otherwise do normal vote
685694 try {
686695 await handleVoting ( interaction , {
Original file line number Diff line number Diff line change @@ -654,9 +654,7 @@ export async function updateQueueLogMessage(
654654 const eloChange = player . elo_change ?? 0
655655 const changeStr = eloChange > 0 ? `+${ eloChange } ` : `${ eloChange } `
656656 const winnerEmoji = team . id === winningTeamId ? '🏆 ' : ''
657- playerLines . push (
658- `${ winnerEmoji } <@${ player . user_id } >: ${ changeStr } MMR (${ player . elo } total)` ,
659- )
657+ playerLines . push ( `${ winnerEmoji } <@${ player . user_id } >: ${ changeStr } MMR` )
660658 }
661659 }
662660
@@ -672,7 +670,6 @@ export async function updateQueueLogMessage(
672670
673671 await queueLogMsg . edit ( {
674672 embeds : [ updatedEmbed ] ,
675- components : [ ] ,
676673 } )
677674
678675 console . log ( `Updated queue log message for match ${ matchId } ` )
Original file line number Diff line number Diff line change @@ -739,13 +739,23 @@ export async function sendQueueLog(
739739 const selectRow =
740740 new ActionRowBuilder < StringSelectMenuBuilder > ( ) . addComponents ( selectMenu )
741741
742+ // Add cancel match button
743+ const cancelButton = new ButtonBuilder ( )
744+ . setCustomId ( `cancel-${ matchId } ` )
745+ . setLabel ( 'Cancel Match' )
746+ . setStyle ( ButtonStyle . Danger )
747+
748+ const buttonRow = new ActionRowBuilder < ButtonBuilder > ( ) . addComponents (
749+ cancelButton ,
750+ )
751+
742752 // Send to logging channel
743753 try {
744754 await matchLog . setLogChannel ( )
745755 if ( matchLog . channel ) {
746756 const matchLogMsg = await matchLog . channel . send ( {
747757 embeds : [ matchLog . embed ] ,
748- components : [ selectRow ] ,
758+ components : [ selectRow , buttonRow ] ,
749759 } )
750760 await setMatchQueueLogMessageId ( matchId , matchLogMsg . id )
751761 }
You can’t perform that action at this time.
0 commit comments