tzi*_*mom 4 bots volume discord discord.js
我正在创建一个 Discord 机器人,并且相处得很好,但是,我现在正在尝试实现一个用于更改机器人音量的命令,但我不知道该怎么做。我在互联网上找到的都是V12或更低版本的,但我使用的是新版本的discord.js - V13。这是我播放音乐的方法:
const connection = await connect(channel);
const audioPlayer = createAudioPlayer();
const stream = createStream(song.url);
const resource = createAudioResource(stream, {
inputType: StreamType.Arbitrary,
});
stream.on('error', () => playQueue(guild, channel));
connection.subscribe(audioPlayer);
audioPlayer.play(resource);
Run Code Online (Sandbox Code Playgroud)
这一切都有效,但你们中有人知道如何更改音量吗?
附带问题:
我还试图/seek <time>跳转到视频中的任何位置,但我也没有取得任何进展。
感谢 Leau,我现在修好了:
我遇到的问题是我试图设置resource.volume为该值,而实际上我必须通过安装resource.volume.setVolume()@discordjs/opus 包并将资源选项inlineVolume设置为 true来完成此操作
| 归档时间: |
|
| 查看次数: |
3260 次 |
| 最近记录: |