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

389
Views
discordjs/voice adapterCreator is not a function

I'm trying to make a play command for my discord bot, but it gives me this error :

TypeError: adapterCreator is not a function

Here is my code:

const ytdl = require('ytdl-core');

module.exports ={
    name:'play',
    description:'aaaaaaaaaaaam',
    execute(message, args){
        const { joinVoiceChannel, createAudioPlayer, createAudioResource, generateDependencyReport } = require('@discordjs/voice');
        const url = 'https://www.youtube.com/watch?v=NevKVKbCNy4&ab_channel=NTDM'
        const stream = ytdl(url, {filter: 'audioonly'});
        const player = createAudioPlayer();
        const resource = createAudioResource(stream);
        const GuildMember = message.author.id;
        const connection = joinVoiceChannel({
            channelId: GuildMember.voiceChannel,
            guildId: message.guild.id,
            adapterCreator: message.channel.guild.voiceAdatperCreator
        })
        connection.subscribe(player);
        player.play(resource);
        
        console.log(generateDependencyReport());
        
    }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem lies in your joinVoiceChannel():

const connection = joinVoiceChannel({
    channelId: message.channelId,
    guildId: message.guildId,
    adapterCreator: message.guild.voiceAdapterCreator
});

Your const GuildMember = message.author.id is actually a string, in which case you cannot do GuildMember.voiceChannel.

message.guildId & message.channelId are shorthands to getting the respective ids.

I suggest reading the voice documentation here:

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!