@@ -621,6 +621,11 @@ function gameWinDaily() {
621621
622622 }
623623
624+ let imgSrc = 'https://storage.ko-fi.com/cdn/cup-border.png' ;
625+ if ( window . isDiscord ) {
626+ imgSrc = getDiscordProxiedUrl ( imgSrc ) ;
627+ } ;
628+
624629 window . dailyModal = $ . confirm ( {
625630 title : `<span class=\"modalText\">${ getWinTerms ( wr ) } ${ ( wr != 0 ? ( ` — ${ wr } wrong` ) : '' ) } </span>` ,
626631 content : `${ getCardHtml ( ) } <div id="dailyTimerDisplay"></div>` ,
@@ -635,7 +640,7 @@ function gameWinDaily() {
635640 closeIcon : true ,
636641 buttons : {
637642 kofi : {
638- text : ' <img src="https://storage.ko-fi.com/cdn/cup-border.png " alt="Ko-Fi">' ,
643+ text : ` <img src="${ imgSrc } " alt="Ko-Fi">` ,
639644 btnClass : 'btn-blue kofi-btn' ,
640645 action : function ( ) {
641646 buyDrink ( ) ;
@@ -1581,6 +1586,15 @@ function reportBug() {
15811586
15821587//function to buy drink
15831588function buyDrink ( ) {
1589+ if ( isDiscord ) {
1590+ try {
1591+ discordSdk . commands . openExternalLink ( { url : 'https://ko-fi.com/suitangi' } ) ;
1592+ } catch ( error ) {
1593+ console . error ( "Could not open link in Discord:" , error ) ;
1594+ }
1595+ return ;
1596+ }
1597+
15841598 let src = "https://ko-fi.com/suitangi/?hidefeed=true&widget=true&embed=true&preview=true" ;
15851599 if ( window . isDiscord ) {
15861600 src = getDiscordProxiedUrl ( src ) ;
@@ -2148,12 +2162,12 @@ function submitDailyData(win) {
21482162
21492163function getDiscordProxiedUrl ( originalUrl ) {
21502164 if ( ! originalUrl ) return '' ;
2151-
2165+
21522166 return originalUrl
21532167 . replace ( "https://api.scryfall.com" , "/scry-com/api" )
21542168 . replace ( "https://c2.scryfall.com" , "/scry-com/c2" )
21552169 . replace ( "https://cards.scryfall.io" , "/scry-io/cards" )
2156- . replace ( "https://svgs.scryfall.io" , "/scry-io/svg " )
2170+ . replace ( "https://svgs.scryfall.io" , "/scry-io/svgs " )
21572171 . replace ( "https://docs.google.com/forms" , "/google/forms" )
21582172 . replace ( "https://ko-fi.com" , "/kofi" )
21592173 . replace ( "https://storage.ko-fi.com" , "/kofi-storage" ) ;
0 commit comments