Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

420
Views
discord.js v13 temp voice channels - joinVoiceChannel() @discordjs/voice

I am trying to add a command, that allows the creation of temporary voice channels.

I have created a new client within this command to try and get the joinVoiceChannel() params another way.

File:

const { joinVoiceChannel } = require ('@discordjs/voice')

module.exports = {
  emoji: '๐Ÿ”ˆ',
  name: 'voice',
  description: 'Create a temporary voice channel',
  execute(interaction) {
    console.log('hi')
    joinVoiceChannel({
      channelId: interaction.channel.id,
      guildId: interaction.guild.id,
      adapterCreator: interaction.guild.voiceAdapterCreator,
    })
  }
}

Error:

TypeError: Cannot read property 'id' of undefined
    at Object.execute (C:\Users\tomfi\Code\DiscordBot\commands\voice.js:11:38)
    at module.exports (C:\Users\tomfi\Code\DiscordBot\events\messageCreate.js:16:17)
    at Client.emit (node:events:394:28)
    at MessageCreateAction.handle (C:\Users\tomfi\Code\DiscordBot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\tomfi\Code\DiscordBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\tomfi\Code\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:345:31)
    at WebSocketShard.onPacket (C:\Users\tomfi\Code\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22)
    at WebSocketShard.onMessage (C:\Users\tomfi\Code\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10)
    at WebSocket.onMessage (C:\Users\tomfi\Code\DiscordBot\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (node:events:394:28)
about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

joinVoiceChannel does not create a voice channel, it creates a voice connection. You need to use GuildChannelManager.create instead. Here is how:

const channel = await interaction.guild.channels.create("VC_NAME", {
  type: "GUILD_VOICE" //note it is "GUILD_VOICE" and not just "voice" anymore
}
joinVoiceChannel({
  channelId: channel.id,
  guildId: interaction.guild.id,
  adapterCreator: interaction.guild.voiceAdapterCreator,
})
about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!