From 35a3cacc58b6ad1c850962fd305a3474b25eb439 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Wed, 23 Mar 2016 04:11:02 +0100 Subject: [PATCH] logs now show user was banned. ref #114 --- NadekoBot/Commands/LogCommand.cs | 10 ++++++++++ NadekoBot/Commands/StreamNotifications.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NadekoBot/Commands/LogCommand.cs b/NadekoBot/Commands/LogCommand.cs index 36713f30..d589f564 100644 --- a/NadekoBot/Commands/LogCommand.cs +++ b/NadekoBot/Commands/LogCommand.cs @@ -22,6 +22,7 @@ namespace NadekoBot.Commands { NadekoBot.Client.MessageDeleted += MsgDltd; NadekoBot.Client.MessageUpdated += MsgUpdtd; NadekoBot.Client.UserUpdated += UsrUpdtd; + NadekoBot.Client.UserBanned += UsrBanned; NadekoBot.Client.MessageReceived += async (s, e) => { @@ -41,6 +42,15 @@ namespace NadekoBot.Commands { }; } + private async void UsrBanned(object sender, UserEventArgs e) { + try { + Channel ch; + if (!logs.TryGetValue(e.Server, out ch)) + return; + await ch.SendMessage($"`User banned:` **{e.User.Name}** ({e.User.Id})"); + } catch { } + } + public Func DoFunc() => async e => { Channel ch; if (!logs.TryRemove(e.Server, out ch)) { diff --git a/NadekoBot/Commands/StreamNotifications.cs b/NadekoBot/Commands/StreamNotifications.cs index cec22aaa..cc58228b 100644 --- a/NadekoBot/Commands/StreamNotifications.cs +++ b/NadekoBot/Commands/StreamNotifications.cs @@ -154,7 +154,7 @@ namespace NadekoBot.Commands { private Func TrackStream(StreamNotificationConfig.StreamType type) => async e => { - var username = e.GetArg("username"); + var username = e.GetArg("username")?.ToLowerInvariant(); if (string.IsNullOrWhiteSpace(username)) return;