<commit_before><?php
/*
 * CodeMOOC TreasureHuntBot
 * ===================
 * UWiClab, University of Urbino
 * ===================
 * Bot-user communicator.
 */

class Communicator {

    private $chat_id;
    private $owning_context;

    function __construct($chat_id, $owning_context) {
        $this->chat_id = $chat_id;
        $this->owning_context = $owning_context;
    }

    function get_telegram_id() {
        return $this->chat_id;
    }

    /**
     * Replies on the current chat.
     */
     function reply($message, $additional_values = null, $additional_parameters = null) {
        return $this->send($this->chat_id, $message, $additional_values, $additional_parameters);
    }

    /**
     * Replies to the current incoming message with a picture.
     */
    function picture($photo_id, $message, $additional_values = null) {
        return telegram_send_photo(
            $this->chat_id,
            $photo_id,
            $this->hydrate_text($message, $additional_values)
        );
    }

    /**
     * Sends out a message on the game-specific channel.
     */
    function channel($message, $additional_values = null) {
        if(!$this->owning_context->game_channel_name) {
            Logger::error("Cannot send message to channel (channel not set)", __FILE__, $this);
            return;
        }

        return $this->send($this->owning_context->game_channel_name, $message, $additional_values, null);
    }

    /**
     * Sends out a picture on the game-specific channel.
     */
    function channel_picture($photo_id, $message, $additional_values = null) {
        if(!$this->owning_context->game->game_channel_name) {<commit_msg>Bugfix: text messages to channels work again<commit_after><?php
/*
 * CodeMOOC TreasureHuntBot
 * ===================
 * UWiClab, University of Urbino
 * ===================
 * Bot-user communicator.
 */

class Communicator {

    private $chat_id;
    private $owning_context;

    function __construct($chat_id, $owning_context) {
        $this->chat_id = $chat_id;
        $this->owning_context = $owning_context;
    }

    function get_telegram_id() {
        return $this->chat_id;
    }

    /**
     * Replies on the current chat.
     */
     function reply($message, $additional_values = null, $additional_parameters = null) {
        return $this->send($this->chat_id, $message, $additional_values, $additional_parameters);
    }

    /**
     * Replies to the current incoming message with a picture.
     */
    function picture($photo_id, $message, $additional_values = null) {
        return telegram_send_photo(
            $this->chat_id,
            $photo_id,
            $this->hydrate_text($message, $additional_values)
        );
    }

    /**
     * Sends out a message on the game-specific channel.
     */
    function channel($message, $additional_values = null) {
        if(!$this->owning_context->game->game_channel_name) {
            Logger::error("Cannot send message to channel (channel not set)", __FILE__, $this);
            return;
        }

        return $this->send($this->owning_context->game->game_channel_name, $message, $additional_values, null);
    }

    /**
     * Sends out a picture on the game-specific channel.
     */
    function channel_picture($photo_id, $message, $additional_values = null) {
        if(!$this->owning_context->game->game_channel_name) {
{'fraction_non_alphanumeric': 0.14159030446349394, 'fraction_numerical': 0.0, 'mean_word_length': 2.764182424916574, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '2330645', 'n_tokens_mistral': 1030, 'n_tokens_neox': 992, 'n_words': 216}