HzMeth
HzMeth

Reputation: 55

Voice channel userlimit discord js

I'm trying to create a voice channel with Discord Bot . This is my code simply (I'm using discord.js)

message.channel.createChannel('General', "voice").then(chan => {
    chan.userLimit("5");
})

But the console log is like that

(node:13080) UnhandledPromiseRejectionWarning: TypeError: message.channel.createChannel is not a function

How can I handle of this?

Upvotes: 1

Views: 2708

Answers (1)

Gilles Heinesch
Gilles Heinesch

Reputation: 2980

You can not use the .createChannel method on a channel, you need to use it on a guild.

This would be correct:
discord.js v11

message.guild.createChannel();

discord.js v12

message.guild.channels.create();

Upvotes: 1

Related Questions