diff --git a/Behavior/TwitchUnsummon.cs b/Behavior/TwitchUnsummon.cs index 9c59e99..b5f75af 100644 --- a/Behavior/TwitchUnsummon.cs +++ b/Behavior/TwitchUnsummon.cs @@ -13,9 +13,13 @@ public class TwitchDismiss : Behavior public override bool ShouldAct(Message message) { + var ti = ProtocolInterfaces.ProtocolList.twitchs.FirstOrDefault(); + Console.WriteLine($"TwitchDismiss checking. menions me? {message.MentionsMe}"); if(message.MentionsMe && (Regex.IsMatch(message.Content.ToLower(), "\\bbegone\\b") || Regex.IsMatch(message.Content.ToLower(), "\\bfuck off\\b"))) { + var channelTarget = message.Content.Substring(message.Content.IndexOf(Trigger) + Trigger.Length + 1).Trim(); + ti.AttemptLeave(channelTarget); //TODO: PERMISSION! who can dismiss me? pretty simple list: //1) anyone in the channel with authority* //2) whoever summoned me diff --git a/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs b/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs index 418a39c..deb473a 100644 --- a/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs +++ b/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs @@ -270,9 +270,8 @@ Channel c = Rememberer.SearchChannel(ci => ci.ExternalId == $"w_{whisperWith}" m.Content = chatMessage.Message; m.ExternalId = chatMessage.Id; m.Channel = UpsertChannel(chatMessage.Channel); - m.Author = UpsertAccount(chatMessage.Username, m.Channel); //TODO: m.channel, instead, for consistency - m.Author.SeenInChannel = m.Channel;//TODO: should be handled in UpsertAccount - m.MentionsMe = Regex.IsMatch(m.Content?.ToLower(), $"\\b@{selfAccountInProtocol.Username.ToLower()}\\b"); + m.Author = UpsertAccount(chatMessage.Username, m.Channel); + m.MentionsMe = Regex.IsMatch(m.Content?.ToLower(), $"@\\b{selfAccountInProtocol.Username.ToLower()}\\b"); m.Reply = (t) => { return Task.Run(() => { client.SendReply(chatMessage.Channel, chatMessage.Id, t); }); }; m.React = (e) => { throw new InvalidOperationException($"twitch cannot react"); }; Rememberer.RememberMessage(m); @@ -294,7 +293,7 @@ Channel c = Rememberer.SearchChannel(ci => ci.ExternalId == $"w_{whisperWith}" m.ExternalId = whisperMessage.MessageId; m.Channel = UpsertDMChannel(whisperMessage.Username); m.Author = UpsertAccount(whisperMessage.Username, m.Channel); - m.MentionsMe = Regex.IsMatch(m.Content?.ToLower(), $"\\b@{selfAccountInProtocol.Username.ToLower()}\\b"); + m.MentionsMe = Regex.IsMatch(m.Content?.ToLower(), $"@\\b{selfAccountInProtocol.Username.ToLower()}\\b"); m.Reply = (t) => { return Task.Run(() => { client.SendWhisper(whisperMessage.Username, t); }); }; m.React = (e) => { throw new InvalidOperationException($"twitch cannot react"); }; Rememberer.RememberMessage(m);