<commit_before><?php

namespace actsmart\actsmart\Sensors\WebChat\Events;

use actsmart\actsmart\Actuators\Slack\SlackMessageAttachment;
use actsmart\actsmart\Sensors\UtteranceEvent;
use actsmart\actsmart\Utils\RegularExpressionHelper;

class MessageEvent extends WebChatEvent implements UtteranceEvent
{
    use RegularExpressionHelper;

    const EVENT_NAME = 'event.webchat.message';

    private $user_id = null;

    private $timestamp = null;

    private $text = null;

    private $attachments = null;

    public function __construct($subject, $arguments = [])
    {
        parent::__construct($subject, $arguments = []);

        // TODO pull the values out of the message
        $this->user_id = $subject->user_id ?? null;
        $this->timestamp = null;
        $this->text = $subject->data->text ?? null;
        $this->attachments = null;
    }

    public function getKey()
    {
        return self::EVENT_NAME;
    }

    public function getUtterance()
    {
        return $this->getSubject()->data->text;
    }

    public function mentions($user_id)
    {
        return $this->userNameMentioned($this->getUtterance(), $user_id);
    }

    /**
     * @return mixed
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * @return mixed
     */
    public function getTimestamp()
    {
        return $this->timestamp;
    }

    /**
     * @return mixed
     */
    public function getTextMessage()
    {
        return $this->text;
    }

    /**
     * @return SlackMessageAttachment[]
     */
    public function getAttachments()
    {
        return $this->attachments;
    }
}<commit_msg>Get message data on MessageEvent<commit_after><?php

namespace actsmart\actsmart\Sensors\WebChat\Events;

use actsmart\actsmart\Actuators\Slack\SlackMessageAttachment;
use actsmart\actsmart\Sensors\UtteranceEvent;
use actsmart\actsmart\Utils\RegularExpressionHelper;

class MessageEvent extends WebChatEvent implements UtteranceEvent
{
    use RegularExpressionHelper;

    const EVENT_NAME = 'event.webchat.message';

    private $user_id = null;

    private $timestamp = null;

    private $text = null;

    private $attachments = null;

    private $data = null;

    public function __construct($subject, $arguments = [])
    {
        parent::__construct($subject, $arguments = []);

        // TODO pull the values out of the message
        $this->user_id = $subject->user_id ?? null;
        $this->timestamp = null;
        $this->text = $subject->data->text ?? null;
        $this->data = $subject->data ?? null;
        $this->attachments = null;
    }

    public function getKey()
    {
        return self::EVENT_NAME;
    }

    public function getUtterance()
    {
        return $this->getSubject()->data->text;
    }

    public function mentions($user_id)
    {
        return $this->userNameMentioned($this->getUtterance(), $user_id);
    }

    /**
     * @return mixed
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * @return mixed
     */
    public function getTimestamp()
    {
        return $this->timestamp;
    }

    /**
     * @return mixed
     */
    public function getTextMessage()
    {
        return $this->text;
    }

    /**
     * @return mixed
     */
    public function getData()
    {
        return $this->data;
    }

    /**
     * @return SlackMessageAttachment[]
     */
    public function getAttachments()
    {
        return $this->attachments;
    }
}
{'fraction_non_alphanumeric': 0.12166003411028994, 'fraction_numerical': 0.0, 'mean_word_length': 2.361031518624642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3423320', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1031, 'n_words': 217}