@@ -17,6 +17,7 @@ import {
17
17
Guild ,
18
18
GuildMember ,
19
19
} from "discord.js" ;
20
+ import { joinVoiceChannel } from "@discordjs/voice" ;
20
21
21
22
export default {
22
23
name : "JOIN_VOICE" ,
@@ -66,12 +67,7 @@ export default {
66
67
return false ;
67
68
}
68
69
69
- const client = state . discordClient as Client ;
70
-
71
- // Check if the client is connected to any voice channel
72
- const isConnectedToVoice = client . voice . adapters . size === 0 ;
73
-
74
- return isConnectedToVoice ;
70
+ return true ;
75
71
} ,
76
72
description : "Join a voice channel to participate in voice chat." ,
77
73
handler : async (
@@ -115,15 +111,8 @@ export default {
115
111
) ;
116
112
} ) ;
117
113
118
- if ( ! state . voiceManager ) {
119
- state . voiceManager = new VoiceManager ( {
120
- client : state . discordClient ,
121
- runtime : runtime ,
122
- } ) ;
123
- }
124
-
125
114
if ( targetChannel ) {
126
- state . voiceManager . joinVoiceChannel ( {
115
+ joinVoiceChannel ( {
127
116
channelId : targetChannel . id ,
128
117
guildId : ( discordMessage as DiscordMessage ) . guild ?. id as string ,
129
118
adapterCreator : ( client . guilds . cache . get ( id ) as Guild )
@@ -134,7 +123,7 @@ export default {
134
123
const member = ( discordMessage as DiscordMessage )
135
124
. member as GuildMember ;
136
125
if ( member ?. voice ?. channel ) {
137
- state . voiceManager . joinVoiceChannel ( {
126
+ joinVoiceChannel ( {
138
127
channelId : member . voice . channel . id ,
139
128
guildId : ( discordMessage as DiscordMessage ) . guild
140
129
?. id as string ,
@@ -204,7 +193,7 @@ You should only respond with the name of the voice channel or none, no commentar
204
193
} ) ;
205
194
206
195
if ( targetChannel ) {
207
- state . voiceManager . joinVoiceChannel ( {
196
+ joinVoiceChannel ( {
208
197
channelId : targetChannel . id ,
209
198
guildId : ( discordMessage as DiscordMessage ) . guild
210
199
?. id as string ,
0 commit comments