C
C
Castiel Unalt2020-04-16 16:44:12
JavaScript
Castiel Unalt, 2020-04-16 16:44:12

How do I migrate from the stable version of discord.js to the master version?

Music bot problem. I rummaged through the Internet and realized that I need to move from the stable version of discord.js to the master version. How to do it?

More specifically, about the error, then here it is:
UnhandledPromiseRejectionWarning: TypeError: connection.play is not a function
Code:

const Discord = module.require("discord.js");
const fs = require("fs");
const ffmpeg = require('ffmpeg');
const ytdl = require('ytdl-core');
const queue = new Map();

module.exports.run = async (bot,message,args) => {
    if(!args[0]){
        bot.send('Вы забыли ввести команду!')
        return
    }
    if(args[0]=='join'){
        if(message.member.voiceChannel){
            const connection = await message.member.voiceChannel.join();
            console.log(connection)
        }else{
            bot.send('Вы не подключились к голосовому чату!')
        }
    }
    if(args[0]=='test'){
        const connection = await message.member.voiceChannel
        const dispatcher = connection.play('e:/Programs/GitHub/castielbot/music/test/ChaosInsurgencyTheme.m4a');
        console.log(connection)
        console.log(dispatcher)
    }
    if(args[0]=='leave'){
        const connection = await message.member.voiceChannel.leave();
        console.log(connection)
    }
};
module.exports.help = {
    name: "m"
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zlatoslav Desyatnikov, 2020-04-16
@pxz

When installing via NPM, you can pass the address of the git repository.
In your case like this:

npm install https://github.com/discordjs/discord.js

But you need to use this with caution, because. you can get unstable code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question