+ private function tagChannelSpecialSent(Channel $channel, $classification) {
+ $this->getNotes($channel);
+ $this->notes[$channel->id]['last_special'][$classification] = time();
+ }
+
+ private function getLatestMessage(Channel $channel) {
+ $this->getNotes($channel);
+ if (!empty($notes['latest_msgs'])) {
+ return $notes['latest_msgs'][count($notes['latest_msgs']) - 1];
+ }
+ return TokenizedMessage::fromString('');
+ }
+
+ private function getLastSpecialSent(Channel $channel) {
+ $notes = $this->getNotes($channel);
+ $max_time = 0;
+ $max_classification = '';
+ foreach ($notes['last_special'] as $classification => $time) {
+ if ($time > $max_time) {
+ $max_time = $time;
+ $max_classification = $classification;
+ }
+ }
+ return $max_classification;
+ }
+
+ private function getTimeSinceSpecial(Channel $channel, $classification) {
+ $notes = $this->getNotes($channel);
+ if (isset($notes['last_special'][$classification])) {
+ return time() - $notes['last_special'][$classification];
+ }
+ return 999999;
+ }
+
+ private function isDirectedAtMe($raw_text) {
+ $text = strtolower($raw_text);
+ if (strpos($text, 'horsti') !== false) {
+ return true;
+ }
+ return false;
+ }
+
+ private function shouldRespond(Channel $channel) {
+ $setting = $channel->getChatSetting('respond', 'yes');
+ if ($setting == 'yes') {
+ return true;
+ }
+ if ($setting == '50') {
+ return random_int(0, 1);
+ }
+ return false;
+ }
+
+ private function getRandomOfClass(Channel $channel, $classification) {
+ if ($classification == 'number') {
+ return $this->randomContextualNumber($channel);
+ }
+ if ($classification == 'lol') {
+ return $this->randomLaughter($channel);
+ }
+ return $channel->randomOfClass($classification);
+ }
+
+ private function getChimeInReaction(Channel $channel, $classification) {
+ switch ($classification) {
+ case 'hi':
+ return ['hi', 'love'];
+ case 'hype':
+ return ['hype', 'love', 'pog'];
+ case 'lol':
+ return ['kappa', 'lol'];
+ case 'pog':
+ return ['hype', 'pog'];
+ case 'wtf':
+ return ['lol', 'wtf'];
+ }
+ return $classification;
+ }
+