@@ -24,37 +24,42 @@ export class DisconnectCommand extends Command {
2424 public override async chatInputRun (
2525 interaction : Command . ChatInputCommandInteraction
2626 ) {
27- if ( interaction . member instanceof GuildMember ) {
28- const { emojis , voice , options } = this . container . client . utils ;
29- const permissions = voice ( interaction ) ;
27+ if ( ! ( interaction . member instanceof GuildMember ) ) {
28+ return interaction . reply ( 'You need to be GuildMember' ) ;
29+ }
3030
31- if ( permissions . member )
32- return interaction . reply ( {
33- content : permissions . member ,
34- ephemeral : true ,
35- } ) ;
36- if ( permissions . client )
37- return interaction . reply ( {
38- content : permissions . client ,
39- ephemeral : true ,
40- } ) ;
41- const queue = useQueue ( interaction . guild ! . id ) ;
42- const player = useMainPlayer ( ) ;
31+ const { emojis, voice, options } = this . container . client . utils ;
32+ const permissions = voice ( interaction ) ;
4333
44- if ( queue )
45- return interaction . reply ( {
46- content : `${ emojis . error } | I am **already** in a voice channel` ,
47- ephemeral : true ,
48- } ) ;
34+ if ( permissions . member ) {
35+ return interaction . reply ( {
36+ content : permissions . member ,
37+ ephemeral : true ,
38+ } ) ;
39+ }
40+ if ( permissions . client ) {
41+ return interaction . reply ( {
42+ content : permissions . client ,
43+ ephemeral : true ,
44+ } ) ;
45+ }
4946
50- const newQueue = player ?. queues . create (
51- interaction . guild ! . id ,
52- options ( interaction )
53- ) ;
54- await newQueue ?. connect ( interaction . member . voice . channel ! . id ) ;
47+ const player = useMainPlayer ( ) ;
48+ const queue = useQueue ( interaction . guild ! . id ) ;
49+ if ( queue ) {
5550 return interaction . reply ( {
56- content : `${ emojis . success } | I have **successfully connected** to the voice channel` ,
51+ content : `${ emojis . error } | I am **already** in a voice channel` ,
52+ ephemeral : true ,
5753 } ) ;
5854 }
55+
56+ const newQueue = player ?. queues . create (
57+ interaction . guild ! . id ,
58+ options ( interaction )
59+ ) ;
60+ await newQueue ?. connect ( interaction . member . voice . channel ! . id ) ;
61+ return interaction . reply ( {
62+ content : `${ emojis . success } | I have **successfully connected** to the voice channel` ,
63+ } ) ;
5964 }
6065}
0 commit comments