private async Task Client_UserVoiceStateUpdated(SocketUser arg1, SocketVoiceState arg2, SocketVoiceState arg3) { if (arg1.IsBot) { return; } var builder = new EmbedBuilder(); builder.Title = $"VC Updated"; builder.WithCurrentTimestamp(); builder.AddField($"Time", DateTime.Now.ToString("HH:mm:ss.fff"), true); var last = LastAction.GetValueOrDefault(arg1.Id, DateTime.MinValue); if (last != DateTime.MinValue) { var diff = DateTime.Now - last; var d = Program.FormatTimeSpan(diff, true); if (string.IsNullOrWhiteSpace(d)) { d = "0s"; } builder.AddField($"Duration", d, true); } LastAction[arg1.Id] = DateTime.Now; builder.WithAuthor($"{arg1.Username}#{arg1.Discriminator}", arg1.GetAnyAvatarUrl()); var beforeUsers = arg2.VoiceChannel?.Users.ToList() ?? new List <SocketGuildUser>(); var afterUsers = arg3.VoiceChannel?.Users.ToList() ?? new List <SocketGuildUser>(); if (arg3.VoiceChannel == null) { builder.Description = $"{arg1.Username} left {arg2.VoiceChannel.Name}"; beforeUsers.Add((SocketGuildUser)arg1); builder.WithColor(Color.Blue); } else if (arg2.VoiceChannel == null) { builder.Description = $"{arg1.Username} joined {arg3.VoiceChannel.Name}"; builder.WithColor(Color.Green); } else if (arg2.VoiceChannel.Id != arg3.VoiceChannel.Id) { builder.Description = $"{arg1.Username} moved from {arg2.VoiceChannel.Name} to {arg3.VoiceChannel.Name}"; builder.WithColor(Color.Teal); } if (string.IsNullOrWhiteSpace(builder.Description)) { return; } builder.AddField("Users", $"{afterUsers.Count}", true); await SendLog((arg2.VoiceChannel ?? arg3.VoiceChannel).Guild, "voice", builder, arg1.Id); }