@ counts as a word barrier
and now twitch unsummon works :)
This commit is contained in:
parent
1d70074d71
commit
91752f012a
@ -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
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user