我的discord机器人在heroku上播放流不起作用

5hcedyr0  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(136)

我想做一个机器人,可以播放在线电台的直播。我使用Discord JS v13。在Heroku上我安装了以下构建包:

我的代码如下:

let voiceChn = message.member.voice.channel;
const connection = joinVoiceChannel({
    channelId: message.member.voice.channel.id,
    guildId: message.member.voice.channel.guildId,
    adapterCreator: message.guild.voiceAdapterCreator,
    selfDeaf: true
  });
const player = createAudioPlayer();
let resource = createAudioResource(STREAM_URL);
connection.subscribe(player);
  connection.on(VoiceConnectionStatus.Ready, () => {
    player.play(resource);
});

它确实可以在我的PC上运行,但不能在Heroku上运行。以下是我安装的软件包:

  • “@discordjs/作品”:“^0.5.3”
  • “@discordjs/休息”:“^0.5.0版本”
  • “@discordjs/声音”:“^0.10.0版本”
  • “不一致API类型”:“^0.36.0”
  • “discord.js”:“^13.8.1”
  • “ffmpeg-静态”:“^4.4.1”
  • “libsodium-wrappers”(libsodium Package 器):“^0.7.10”

我得到以下错误:播放器会立即发出idle事件并记录:

{
status: 'playing',
missedFrames: 0,
playbackDuration: 120,
resource: AudioResource {
    playStream: OggDemuxer {
    _readableState: [ReadableState],
    _events: [Object: null prototype],
    _eventsCount: 5,
    _maxListeners: undefined,
    _writableState: [WritableState],
    allowHalfOpen: true,
    _remainder: null,
    _head: null,
    _bitstream: null,
    [Symbol(kCapture)]: false,
    [Symbol(kCallback)]: null
},
    edges: [ [Object], [Object] ],
    metadata: null,
    volume: undefined,
    encoder: undefined,
    audioPlayer: undefined,
    playbackDuration: 0,
    started: true,
    silencePaddingFrames: 5,
    silenceRemaining: 0
},
onStreamError: [Function: onStreamError]
}
pobjuy32

pobjuy321#

不确定错误,但我相信我有同样的问题,并修复了它。没有测试是否需要所有的更改,但这里去:

'https://stream.skymedia.ee/live/NRJdnb' becomes 'http://185.31.240.229:8888/NRJdnb'

  • 在更改代码后部署斜杠命令

相关问题