@@ -74,44 +74,33 @@ export const osuprofile = {
74
74
. setDescription (
75
75
`• **Rank:** ${
76
76
osuUser . statistics . global_rank
77
- ? '#' +
78
- osuUser . statistics . global_rank
79
- . toString ( )
80
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) +
81
- ` (${ osuUser . country_code } #${ osuUser . statistics . rank . country
82
- . toString ( )
83
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } )`
77
+ ? `#${ standardizeNumber ( osuUser . statistics . global_rank , ',' ) } (${
78
+ osuUser . country_code
79
+ } #${ standardizeNumber ( osuUser . statistics . rank . country , ',' ) } )`
84
80
: ' `unranked`'
85
- } \n• **Ranked score:** ${ osuUser . statistics . ranked_score
86
- . toString ( )
87
- . replace (
88
- / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g,
89
- ' '
90
- ) } \n• **Accuracy:** ${ osuUser . statistics . hit_accuracy . toPrecision (
81
+ } \n• **Ranked score:** ${ standardizeNumber (
82
+ osuUser . statistics . ranked_score ,
83
+ ' '
84
+ ) } \n• **Accuracy:** ${ osuUser . statistics . hit_accuracy . toPrecision (
91
85
4
92
86
) } %\n• **Level:** ${ osuUser . statistics . level . current } .${
93
87
osuUser . statistics . level . progress
94
- } \n• **Scores: ${
95
- OSU_GRADES_EMOTES_ARRAY . XH
96
- } ${ osuUser . statistics . grade_counts . ssh
97
- . toString ( )
98
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } ${
99
- OSU_GRADES_EMOTES_ARRAY . SH
100
- } ${ osuUser . statistics . grade_counts . sh
101
- . toString ( )
102
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } ${
103
- OSU_GRADES_EMOTES_ARRAY . X
104
- } ${ osuUser . statistics . grade_counts . ss
105
- . toString ( )
106
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } ${
107
- OSU_GRADES_EMOTES_ARRAY . S
108
- } ${ osuUser . statistics . grade_counts . s
109
- . toString ( )
110
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } ${
111
- OSU_GRADES_EMOTES_ARRAY . A
112
- } ${ osuUser . statistics . grade_counts . a
113
- . toString ( )
114
- . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, ',' ) } **`
88
+ } \n• **Scores: ${ OSU_GRADES_EMOTES_ARRAY . XH } ${ standardizeNumber (
89
+ osuUser . statistics . grade_counts . ssh ,
90
+ ','
91
+ ) } ${ OSU_GRADES_EMOTES_ARRAY . SH } ${ standardizeNumber (
92
+ osuUser . statistics . grade_counts . sh ,
93
+ ','
94
+ ) } ${ OSU_GRADES_EMOTES_ARRAY . X } ${ standardizeNumber (
95
+ osuUser . statistics . grade_counts . ss ,
96
+ ','
97
+ ) } ${ OSU_GRADES_EMOTES_ARRAY . S } ${ standardizeNumber (
98
+ osuUser . statistics . grade_counts . s ,
99
+ ','
100
+ ) } ${ OSU_GRADES_EMOTES_ARRAY . A } ${ standardizeNumber (
101
+ osuUser . statistics . grade_counts . a ,
102
+ ','
103
+ ) } **`
115
104
) ;
116
105
return interaction . reply ( { embeds : [ osuProfileEmbed ] } ) ;
117
106
}
@@ -122,3 +111,7 @@ const retrieveUserOsuId = async (
122
111
) : Promise < string | null > => {
123
112
return profileData ?. osuUserID ?? null ;
124
113
} ;
114
+
115
+ const standardizeNumber = ( number : number , replacement : string ) : string => {
116
+ return number . toString ( ) . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, replacement ) ;
117
+ } ;
0 commit comments