X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FTokenizedMessage.php;h=72817c1dbc6066556f77e134684e74137d64f863;hb=1dea58cb6fa9cf28966e75c1e1af87f67e6c0fd1;hp=b460020a3e2e2a42a5683cf7ba78c41f1e01792b;hpb=5df7f3ed455c56370b3c4b690b0ca47b183fa829;p=alttp.git diff --git a/app/TwitchBot/TokenizedMessage.php b/app/TwitchBot/TokenizedMessage.php index b460020..72817c1 100644 --- a/app/TwitchBot/TokenizedMessage.php +++ b/app/TwitchBot/TokenizedMessage.php @@ -11,10 +11,13 @@ class TokenizedMessage { public function __construct($text, $tags = []) { $this->text = trim($text); $this->tags = $tags; + if (isset($tags['reply-parent-display-name'])) { + $this->text = mb_substr($text, mb_strlen($tags['reply-parent-display-name']) + 2); + } $this->raw = strtolower(preg_replace('/[^\w]/u', '', $this->text)); $this->tokens = array_values(array_map('trim', array_filter(preg_split('/\b/u', strtolower($this->text))))); - $this->emoteless = $this->text; + $this->emoteless = $text; if (isset($this->tags['emotes']) && !empty($this->tags['emotes'])) { $emotes = explode('/', $this->tags['emotes']); foreach ($emotes as $emote) { @@ -253,7 +256,7 @@ class TokenizedMessage { if ($this->contains(['€', '$', '@', '://'])) { return true; } - if ($this->containsRaw(['followers', 'promotion', 'viewers'])) { + if ($this->containsRaw(['follow', 'promotion', 'viewer'])) { return true; } if ($this->containsRaw('horsti')) {