private async Task OnUserVoiceStateChanged(SocketUser user, SocketVoiceState voiceStateBefore, SocketVoiceState voiceStateAfter) { var guildId = await _servers.GetUserLogChannel(((SocketGuildUser)user).Guild.Id); if (!(_client.GetChannel(guildId) is ISocketMessageChannel messageChannel)) { return; } if (!Equals(voiceStateBefore.VoiceChannel, voiceStateAfter.VoiceChannel) && voiceStateAfter.VoiceChannel != null && voiceStateBefore.VoiceChannel == null) { await EventExtension.UserVoiceJoined(user, voiceStateAfter.VoiceChannel, messageChannel); } else if (!Equals(voiceStateAfter.VoiceChannel, voiceStateBefore.VoiceChannel) && voiceStateBefore.VoiceChannel != null && voiceStateAfter.VoiceChannel == null) { await EventExtension.UserVoiceLeft(user, voiceStateBefore.VoiceChannel, messageChannel); } else if (!Equals(voiceStateAfter.VoiceChannel, voiceStateBefore.VoiceChannel) && voiceStateBefore.VoiceChannel != null && voiceStateAfter.VoiceChannel != null) { await EventExtension.UserVoicejumped(user, voiceStateBefore.VoiceChannel, voiceStateAfter.VoiceChannel, messageChannel); } }