discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.38k stars 3.97k forks source link

Erreur : connection.play is not a function . #4353

Closed Konixy closed 4 years ago

Konixy commented 4 years ago

Bonjour, j'ai un probleme avec les commandes de musique discord.js,

au code :

const connection = await message.member.voice.channel.join();
       const ytdl = require('ytdl-core');
       connection.play(ytdl('https://www.youtube.com/watch?v=-9T5fLmn7rY', { filter: 'audioonly' }));

j'ai l'erreur

TypeError: connection.play is not a function
    at Client.<anonymous> (e:\discord\bot\index.js:229:19)
    at Client.emit (events.js:311:20)
    at MessageCreateAction.handle (e:\discord\bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (e:\discord\bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (e:\discord\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (e:\discord\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (e:\discord\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (e:\discord\bot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:311:20)
    at Receiver.receiverOnMessage (e:\discord\bot\node_modules\ws\lib\websocket.js:800:20)

merci d'avance

Further details:

iCrawl commented 4 years ago

The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.