【问题标题】:'MODULE_NOT_FOUND' in discord.js v13 audio/music botdiscord.js v13 音频/音乐机器人中的“MODULE_NOT_FOUND”
【发布时间】:2021-11-29 18:13:04
【问题描述】:

我为我和我的朋友们准备了这个简单的音乐机器人,但是在升级到 discord.js 的 v13 之后,有些东西就不再起作用了……我已经改变了一些东西,就像 discord.js guide 告诉你的那样做。有人知道这里出了什么问题??

const ytdl = require('ytdl-core');
const Music = require('discordjs/voice');

console.log("is this working");

//  PLAYER
 client.on("messageCreate", async message => {

  if(message.content == 'goplay') {
  const url = args[0];
  if(!url) return message.channel.send('no url');


  const stream = ytdl(url, { filter: 'audioonly'});

  const channel = message.member.voice.channel;

  const player = Music.createAudioPlayer();
  const ressource = Music.createAudioResource(stream);

  const connection = Music.joinVoiceChannel({
   channelId: message.member.voice.channel.id,
   guildId: message.channel.guild,
   adapterCreator: message.guild.voiceAdapterCreator,
  });

  player.play(ressource)
  connection.subscribe(player);

  }
});

here is the error message

【问题讨论】:

  • 您是否在您的机器人文件夹中创建了一个 index-voice.js(或曾经有一个)?

标签: javascript node.js discord.js voice


【解决方案1】:

这看起来像 package.json 错误。确保您已创建 package.json。

使用命令npm init,并填写所需信息,让它自动创建使用npm init -y 的所有内容(然后确保安装所有npm 包)

【讨论】:

  • 所以它做了一些事情。我很抱歉这个业余错误......谢谢男人
猜你喜欢
  • 2022-01-11
  • 2021-12-06
  • 2020-09-22
  • 2020-08-04
  • 2020-12-01
  • 2021-05-27
  • 2020-06-27
  • 2021-02-07
  • 2020-09-30
相关资源
最近更新 更多