diff --git a/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/NadekoBot/Modules/Administration/Commands/LogCommand.cs index c59d6d1d..54fc4c40 100644 --- a/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -212,22 +212,41 @@ $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}` if (loggingPresences.TryGetValue(e.Server, out ch)) if (e.Before.Status != e.After.Status) { - await ch.SendMessage($"`[{DateTime.Now:HH:mm:ss}]`**{e.Before.Name}** is now **{e.After.Status}**.").ConfigureAwait(false); + await ch.SendMessage($"`{prettyCurrentTime}`**{e.Before.Name}** is now **{e.After.Status}**.").ConfigureAwait(false); } } catch { } try { - if (e.Before.VoiceChannel != null && voiceChannelLog.ContainsKey(e.Before.VoiceChannel)) + Channel notifyChBefore = null; + Channel notifyChAfter = null; + var beforeVch = e.Before.VoiceChannel; + var afterVch = e.After.VoiceChannel; + var notifyLeave = false; + var notifyJoin = false; + if ((beforeVch != null || afterVch != null) && (beforeVch != afterVch)) // this means we need to notify for sure. { - if (e.After.VoiceChannel != e.Before.VoiceChannel) - await voiceChannelLog[e.Before.VoiceChannel].SendMessage($"🎼`{e.Before.Name} has left the` {e.Before.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); - } - if (e.After.VoiceChannel != null && voiceChannelLog.ContainsKey(e.After.VoiceChannel)) - { - if (e.After.VoiceChannel != e.Before.VoiceChannel) - await voiceChannelLog[e.After.VoiceChannel].SendMessage($"🎼`{e.After.Name} has joined the`{e.After.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); + if (beforeVch != null && voiceChannelLog.TryGetValue(beforeVch, out notifyChBefore)) + { + notifyLeave = true; + } + if (afterVch != null && voiceChannelLog.TryGetValue(afterVch, out notifyChAfter)) + { + notifyJoin = true; + } + if ((notifyLeave && notifyJoin) && (notifyChAfter == notifyChBefore)) + { + await notifyChAfter.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} moved from **{beforeVch.Mention}** to **{afterVch.Mention}** voice channel.").ConfigureAwait(false); + } + else if (notifyJoin) + { + await notifyChAfter.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} has joined **{afterVch.Mention}** voice channel.").ConfigureAwait(false); + } + else if (notifyLeave) + { + await notifyChBefore.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} has left **{beforeVch.Mention}** voice channel.").ConfigureAwait(false); + } } } catch { } diff --git a/NadekoBot/Modules/Searches/SearchesModule.cs b/NadekoBot/Modules/Searches/SearchesModule.cs index 4bde7f97..edc29dbc 100644 --- a/NadekoBot/Modules/Searches/SearchesModule.cs +++ b/NadekoBot/Modules/Searches/SearchesModule.cs @@ -460,7 +460,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】 .Parameter("color", ParameterType.Unparsed) .Do(async e => { - var arg1 = e.GetArg("color")?.Trim(); + var arg1 = e.GetArg("color")?.Trim()?.Replace("#", ""); if (string.IsNullOrWhiteSpace(arg1)) return; var img = new Bitmap(50, 50);