File tree 1 file changed +4
-20
lines changed
1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change 1
1
import { container , SapphireClient } from '@sapphire/framework' ;
2
- import { EmbedBuilder , User } from 'discord.js' ;
2
+ import { EmbedBuilder } from 'discord.js' ;
3
3
import {
4
4
CodeyCommandDetails ,
5
5
getUserFromMessage ,
@@ -40,13 +40,8 @@ const getCoinLeaderboardEmbed = async (
40
40
break ;
41
41
}
42
42
const userCoinEntry = leaderboard [ i ++ ] ;
43
- let user : User ;
44
- try {
45
- user = await client . users . fetch ( userCoinEntry . user_id ) ;
46
- } catch ( e ) {
47
- continue ;
48
- }
49
- if ( user . bot ) continue ;
43
+ const user = await client . users . fetch ( userCoinEntry . user_id ) . catch ( ( ) => null ) ;
44
+ if ( user ?. bot ) continue ;
50
45
if ( previousBalance === userCoinEntry . balance ) {
51
46
previousBalance = userCoinEntry . balance ;
52
47
// rank does not change
@@ -60,18 +55,7 @@ const getCoinLeaderboardEmbed = async (
60
55
position = rank ;
61
56
}
62
57
if ( leaderboardArray . length < LEADERBOARD_LIMIT_DISPLAY ) {
63
- const userTag = user ?. tag ?? '<unknown>' ;
64
- const cleanUserTag = userTag
65
- . split ( '~' )
66
- . join ( '\\~' )
67
- . split ( '*' )
68
- . join ( '\\*' )
69
- . split ( '_' )
70
- . join ( '\\_' )
71
- . split ( '`' )
72
- . join ( '\\`' ) ;
73
- // added a "\\" below in ${rank}\\. ${cleanUserTag} so that Markdown does not automatically increment by 1 each time
74
- const userCoinEntryText = `${ rank } \\. ${ cleanUserTag } - ${
58
+ const userCoinEntryText = `${ rank } \\. <@${ userCoinEntry . user_id } > - ${
75
59
userCoinEntry . balance
76
60
} ${ getCoinEmoji ( ) } `;
77
61
leaderboardArray . push ( userCoinEntryText ) ;
You can’t perform that action at this time.
0 commit comments