private async Task Client_VoiceStateUpdated(DiscordClient sender, DSharpPlus.EventArgs.VoiceStateUpdateEventArgs __) { // Say it with me, everyone! // F**K 👏 DSHARPPLUS 👏 ASYNC 👏 TIMEOUTS 👏 _ = Task.Run(async() => { var userCount = channel.Users.Count(x => x.Id != client.CurrentUser.Id); await Logger.Debug("Channel Count", $"Currently I believe there are {userCount} members (that aren't myself) in the channel."); if (userCount >= config.MinimumUserCount && !detectionService.Enabled) { await Logger.Warning("Monitor", $"Users detected, joining voice channel..."); inactivityRestartTimer.DisableTimer(); // I do not get why DSharpPlus enforces a max execution time on their async events, // and at this point I'm getting really sick of them. _ = Task.Run(async() => await detectionService.Enable(channel)); } else if (userCount < config.MinimumUserCount && detectionService.Enabled) { await Logger.Warning("Monitor", $"No other users detected, leaving voice channel..."); inactivityRestartTimer.EnableTimer(); detectionService.Disable(); } }); }
public static Task Client_VoiceStateUpdated(DiscordClient sender, DSharpPlus.EventArgs.VoiceStateUpdateEventArgs e) { return(Task.CompletedTask); }