Discord.Net
Discord.Net copied to clipboard
SpeakingUpdated only triggering once per user
A few months ago every time somebody in a channel with the bot connected to started or stopped to speak, the SpeakingUpdated event on the audioClient was triggered. But now it only gets triggered the first time a user in a channel starts to speak. Is there anything I need to do to reset the event trigger or is this a bug with the API?
Can you provide example code for us to replicate the bug?
Here is some example code for the Audio side:
public class AudioService
{
private readonly DiscordSocketClient _discord;
public AudioService(IServiceProvider services)
{
_discord = services.GetRequiredService<DiscordSocketClient>();
}
public async Task JoinAudio(IGuild guild, IVoiceChannel target)
{
var audioClient = await target.ConnectAsync();
audioClient.SpeakingUpdated += AudioClient_SpeakingUpdated;
}
private async Task AudioClient_SpeakingUpdated(ulong userID, bool speaking)
{
Task<SocketUser> user = Task.Run(() => _discord.GetUser(userID));
Console.WriteLine((await user).Username + (speaking ? " started" : " stopped") + " speaking");
}
}
A proof-of-concept project can be found here. It will only produce output like this even when speaking is interrupted (green circle in Discord disappears):
20:22:59 Discord Discord.Net v2.2.0 (API v6)
20:23:00 Gateway Connecting
20:23:00 Gateway Connected
20:23:01 Gateway Ready
20:23:15 Audio #1 Connecting
20:23:15 Audio #1 Unknown OpCode (Hello)
20:23:15 Audio #1 Connected
n1kPLV started speaking
Edit: Clarified the example Code and fixed some typos
I also have the same issue. I am able to receive audio bytes on the AudioInStream for the user, but the SpeakingUpdated events don't fire more than once.
Still seeing this issue as of today. Trying to determine when the user has started and stopped speaking but this event only fires once when the user starts speaking.
Just ran into this as well.
Also cannot connect to foxbot.me at all to grab opus.dll files - bit skunked there as well.
Any updates on this issue?
Still seeing this issue. The event is fired once when the user starts speaking.
I found same issue was occured another library.
https://github.com/discordjs/discord.js/issues/3524
Thus, I think maybe this issue isn't this library's problem. then Discord's problem.
If you go to the link supplied in that issue to another issue, one user describes the event firing twice.
https://github.com/discordjs/discord.js/issues/3524#issuecomment-540898469
Need some input from the lib developers, would be useful to know if this is an actual issue on the library side or Discord's side.
Anyone found a fix for this yet?