不和谐.NET c# Bot退出语音通道



机器人进入并立即退出语音通道。同时,如果没有人在语音聊天,那么机器人会静静地呆在那里。如果有的话,我下载了opus.dll并将其与exe文件放在一起,我不知道问题是什么。请帮助。

误差

20:54:58 App Command System.BadImageFormatException: An attempt was made to load a program with an invalid format. (0x8007000B)
at Discord.Audio.OpusDecoder.CreateDecoder(Int32 Fs, Int32 channels, OpusError& error)
at Discord.Audio.OpusDecoder..ctor()
at Discord.Audio.Streams.OpusDecodeStream..ctor(AudioStream next)
at Discord.Audio.AudioClient.CreateInputStreamAsync(UInt64 userId)
at Discord.WebSocket.SocketGuild.RepopulateAudioStreamsAsync()
at Discord.WebSocket.SocketGuild.FinishConnectAudio(String url, String token)
at Discord.WebSocket.SocketGuild.ConnectAudioAsync(UInt64 channelId, Boolean selfDeaf, Boolean selfMute, Boolean external)
at Discord.WebSocket.SocketGuild.ConnectAudioAsync(UInt64 channelId, Boolean selfDeaf, Boolean selfMute, Boolean external)
at Discord.WebSocket.SocketVoiceChannel.ConnectAsync(Boolean selfDeaf, Boolean selfMute, Boolean external)
at discord_bot.Modules.ExampleCommands.JoinChannel(IVoiceChannel channel) in C:Usershybassourcereposdiscord-botdiscord-botModulesExampleCommands.cs:line 58
at Discord.Interactions.Builders.ModuleClassBuilder.<>c__DisplayClass11_0.<<CreateCallback>g__ExecuteCallback|1>d.MoveNext()

我从官方Discord中获取了连接语音聊天的代码。网络文档

[Command("join", RunMode = RunMode.Async)] 
public async Task JoinChannel(IVoiceChannel channel = null)
{
// Get the audio channel
channel = channel ?? (Context.User as IGuildUser)?.VoiceChannel;
if (channel == null) { await Context.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be passed as an argument."); return; }
// For the next step with transmitting audio, you would want to pass this Audio Client in to a service.
var audioClient = await channel.ConnectAsync();
}

好了,我刚刚构建了应用程序,并加入了opus和lib钠库,它工作了

相关内容

  • 没有找到相关文章

最新更新