@@ -172,7 +172,7 @@ dbClient.on(Events.ClientReady, async () => {
172172
173173 if ( descpMemory [ streamId ] != oldDescpMemory [ streamId ] && ax . data . data . length == 1 ) {
174174 sendLiveNotifEmbed ( ax ) ;
175- console . log ( `[${ getCurrentDatetime ( 'comm' ) } ]# Notif Twitch ${ ax . data . data [ 0 ] . user_name } ` ) ;
175+ console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] Notif Twitch ${ ax . data . data [ 0 ] . user_name } ` ) ;
176176 } ;
177177 } ;
178178
@@ -370,7 +370,10 @@ dbClient.on(Events.MessageCreate, async (message) => {
370370 case 'reset' :
371371 resetBot ( message , dbClient , author , msg ) ;
372372 return ;
373- case 'language' || 'lang' :
373+ case 'language' :
374+ setLanguage ( message , author , msg , args ) ;
375+ return ;
376+ case 'lang' :
374377 setLanguage ( message , author , msg , args ) ;
375378 return ;
376379 case checkCollection :
@@ -521,7 +524,7 @@ async function processMobBot(message, state) {
521524
522525async function sendLiveNotifEmbed ( ax ) {
523526 let guidDot = await axios . get ( `https://twitch.tv/${ ax . data . data [ 0 ] . user_login } ` ) ,
524- guid = '' ,
527+ guid = '' ,
525528 dot = '' ;
526529
527530 try {
@@ -531,14 +534,9 @@ async function sendLiveNotifEmbed(ax) {
531534 dot = guidDot . data . split ( new RegExp ( `(ge-[.]*...........)` , 'giu' ) ) [ 1 ] ;
532535 dot = dot . split ( '.' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
533536 } catch ( err ) {
534- console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] # Can't get guid and dot : ` , err ) ;
537+ console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] Can't get guid and dot : ` , err ) ;
535538 } ;
536539
537- if ( guid == undefined || dot == undefined ) {
538- guid = 0 ;
539- dot = 0 ;
540- }
541-
542540 for ( chan in channelTwitch ) {
543541 var channelSend = dbClient . channels . cache . find ( channel => channel . name == channelTwitch [ chan ] ) ;
544542
@@ -603,43 +601,45 @@ function exportingDataSet(message) {
603601} ;
604602
605603async function getHelp ( message , desc ) {
606- try {
607- let twitch = 'https://twitch.tv/daftmob' ,
608- guidDot = await axios . get ( twitch ) ;
604+ let twitch = 'https://twitch.tv/daftmob' ,
605+ guidDot = await axios . get ( twitch ) ,
606+ guid = '' ,
607+ dot = '' ;
609608
610- let guid = guidDot . data . split ( new RegExp ( `(s\/[^.]*-p)` , 'giu' ) ) [ 1 ] ;
609+ try {
610+ guid = guidDot . data . split ( new RegExp ( `(s\/[^.]*-p)` , 'giu' ) ) [ 1 ] ;
611611 guid = guid . split ( 's/' ) [ 1 ] . split ( '-p' ) [ 0 ] ;
612612
613- let dot = guidDot . data . split ( new RegExp ( `(ge-[.]*...........)` , 'giu' ) ) [ 1 ] ;
613+ dot = guidDot . data . split ( new RegExp ( `(ge-[.]*...........)` , 'giu' ) ) [ 1 ] ;
614614 dot = dot . split ( '.' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
615-
616- message . author . send ( {
617- 'channel_id' : `${ message . channel . channel_id } ` ,
618- 'content' : '' ,
619- 'tts' : false ,
620- 'embeds' : [ {
621- 'type' : 'rich' ,
622- 'title' : `${ language . helpTitle } ` ,
623- 'description' : `${ desc } ` ,
624- 'color' : 0x0eb70b ,
625- 'timestamp' : `2023-02-02T03:20:42.000Z` ,
626- 'author' : {
627- 'name' : `${ dbClient . user . username } `
628- } ,
629- 'footer' : {
630- 'text' : `${ language . helpAuthor } ` ,
631- 'icon_url' : `https://static-cdn.jtvnw.net/jtv_user_pictures/${ guid } -profile_image-300x300.${ dot } ` ,
632- 'proxy_icon_url' : twitch
633- }
634- } ]
635- } ) ;
636-
637- if ( desc == language . helpTopGg ) console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] ${ message . guild . name } / ${ message . channel . name } # ${ message . author . username } : ${ message . content . toLowerCase ( ) } trolled` ) ;
638- else console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] ${ message . guild . name } / ${ message . channel . name } # ${ message . author . username } : ${ message . content . toLowerCase ( ) } ` ) ;
639615 } catch ( err ) {
640616 message . channel . send ( language . error ) ;
641- console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] ${ message . guild . name } / ${ message . channel . name } # Error help() : ${ err } ` ) ;
617+ console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] Can't get guid and dot : ` , err ) ;
642618 } ;
619+
620+ message . author . send ( {
621+ 'channel_id' : `${ message . channel . channel_id } ` ,
622+ 'content' : '' ,
623+ 'tts' : false ,
624+ 'embeds' : [ {
625+ 'type' : 'rich' ,
626+ 'title' : `${ language . helpTitle } ` ,
627+ 'description' : `${ desc } ` ,
628+ 'color' : 0x0eb70b ,
629+ 'timestamp' : `2023-02-06T19:20:42.000Z` ,
630+ 'author' : {
631+ 'name' : `${ dbClient . user . username } `
632+ } ,
633+ 'footer' : {
634+ 'text' : `${ language . helpAuthor } ` ,
635+ 'icon_url' : `https://static-cdn.jtvnw.net/jtv_user_pictures/${ guid } -profile_image-300x300.${ dot } ` ,
636+ 'proxy_icon_url' : twitch
637+ }
638+ } ]
639+ } ) ;
640+
641+ if ( desc == language . helpTopGg ) console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] ${ message . guild . name } / ${ message . channel . name } # ${ message . author . username } : ${ message . content . toLowerCase ( ) } trolled` ) ;
642+ else console . log ( `[${ getCurrentDatetime ( 'comm' ) } ] ${ message . guild . name } / ${ message . channel . name } # ${ message . author . username } : ${ message . content . toLowerCase ( ) } ` ) ;
643643} ;
644644
645645async function setLanguage ( message , author , msg , args ) {
0 commit comments