File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 4
4
ButtonBuilder ,
5
5
ButtonStyle ,
6
6
CommandInteraction ,
7
+ Message ,
7
8
type TextChannel ,
8
9
} from 'discord.js' ;
9
10
import type { Context , Lavamusic } from '../structures/index' ;
@@ -58,7 +59,7 @@ export class Utils {
58
59
}
59
60
60
61
public static parseTime ( string : string ) : number {
61
- const time = string . match ( / ( [ 0 - 9 ] + [ d , h , m , s ] ) / g) ;
62
+ const time = string . match ( / ( \d + [ d h m s ] ) / g) ;
62
63
if ( ! time ) return 0 ;
63
64
let ms = 0 ;
64
65
for ( const t of time ) {
@@ -125,17 +126,25 @@ export class Utils {
125
126
} ;
126
127
127
128
const msgOptions = getButton ( 0 ) ;
128
- const msg = ctx . isInteraction
129
- ? await ( ctx . deferred
130
- ? ctx . interaction ! . followUp ( {
131
- ...msgOptions ,
132
- fetchReply : true as boolean ,
133
- } )
134
- : ctx . interaction ! . reply ( { ...msgOptions , fetchReply : true } ) )
135
- : await ( ctx . channel as TextChannel ) . send ( {
129
+ let msg : Message ;
130
+ if ( ctx . isInteraction ) {
131
+ if ( ctx . deferred ) {
132
+ msg = await ctx . interaction ! . followUp ( {
136
133
...msgOptions ,
137
134
fetchReply : true ,
138
135
} ) ;
136
+ } else {
137
+ msg = ( await ctx . interaction ! . reply ( {
138
+ ...msgOptions ,
139
+ fetchReply : true ,
140
+ } ) ) as unknown as Message ;
141
+ }
142
+ } else {
143
+ msg = await ( ctx . channel as TextChannel ) . send ( {
144
+ ...msgOptions ,
145
+ fetchReply : true ,
146
+ } ) ;
147
+ }
139
148
140
149
const author = ctx instanceof CommandInteraction ? ctx . user : ctx . author ;
141
150
You can’t perform that action at this time.
0 commit comments