<commit_before><?php

namespace App\Http\Controllers;

use App\Models\Call;
use App\Models\Game;
use App\Models\Roll;
use App\Models\User;
use App\Models\GameParticipant;
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
use Log;

class LiarsDiceBotController extends Controller
{

    protected $user;
    protected $game;
    protected $calls;
    protected $first_round = false;
    protected $participants;
    protected $current_call;
    protected $dice_left_in_game;
    protected $participant_count;
    protected $current_round_rolls;
    protected $current_participant;
    protected $current_round_participants;
    protected $current_round_participant_count;
    protected $current_eligible_participant_order;
    protected $next_eligible_participant_order;
    protected $next_participant;
    protected $next_user;

    protected $emoji_numbers = [
        1 => ":one:",
        2 => ":two:",
        3 => ":three:",
        4 => ":four:",
        5 => ":five:",
        6 => ":six:",
    ];

    public function handle(BotMan $bot)
    {
        $msg_txt = $bot->getMessage()->getText();

        if ($msg_txt == 'help') {
            $this->help($bot);
        } elseif($msg_txt == 'play liar') {
            $this->host($bot);
        } elseif($msg_txt == 'close game') {
            $this->close($bot);
        } elseif($msg_txt == 'me') {
            $this->join($bot);
        } elseif($msg_txt == 'leave') {
            $this->leave($bot);
        } elseif($msg_txt == 'start game') {
            $this->start($bot);
        } elseif(preg_match('/([1-9]{0,1}[0-9]+(,|.)[0-6])/', $msg_txt)) {
            $this->playRound($bot);
        } elseif($msg_txt == 'liar') {
            $this->playRound($bot);
        } elseif($msg_txt == 'abort game') {
            $this->abort($bot);
        } elseif(preg_match('/say .*/', $msg_txt)) {
            $this->say($bot);
        }
    }

    public function help(BotMan $bot)
    {
        $this->handleUser($bot);
        if(!$this->messageSentToBot($bot)) {
            return;
        }
        $message = OutgoingMessage::create('The rules for the games are a bit too long to post on slack.. so here is a link: https://liarsapp.valentin.nu/help');
        $bot->say($message, $this->user->slack_id);<commit_msg>Enabling commands for "play liar" again.<commit_after><?php

namespace App\Http\Controllers;

use App\Models\Call;
use App\Models\Game;
use App\Models\Roll;
use App\Models\User;
use App\Models\GameParticipant;
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
use Log;

class LiarsDiceBotController extends Controller
{

    protected $user;
    protected $game;
    protected $calls;
    protected $first_round = false;
    protected $participants;
    protected $current_call;
    protected $dice_left_in_game;
    protected $participant_count;
    protected $current_round_rolls;
    protected $current_participant;
    protected $current_round_participants;
    protected $current_round_participant_count;
    protected $current_eligible_participant_order;
    protected $next_eligible_participant_order;
    protected $next_participant;
    protected $next_user;

    protected $emoji_numbers = [
        1 => ":one:",
        2 => ":two:",
        3 => ":three:",
        4 => ":four:",
        5 => ":five:",
        6 => ":six:",
    ];

    public function handle(BotMan $bot)
    {
        $msg_txt = $bot->getMessage()->getText();

        if ($msg_txt == 'help') {
            $this->help($bot);
        } elseif(preg_match('/play liar.*/', $msg_txt)) {
            $this->host($bot);
        } elseif($msg_txt == 'close game') {
            $this->close($bot);
        } elseif($msg_txt == 'me') {
            $this->join($bot);
        } elseif($msg_txt == 'leave') {
            $this->leave($bot);
        } elseif($msg_txt == 'start game') {
            $this->start($bot);
        } elseif(preg_match('/([1-9]{0,1}[0-9]+(,|.)[0-6])/', $msg_txt)) {
            $this->playRound($bot);
        } elseif($msg_txt == 'liar') {
            $this->playRound($bot);
        } elseif($msg_txt == 'abort game') {
            $this->abort($bot);
        } elseif(preg_match('/say .*/', $msg_txt)) {
            $this->say($bot);
        }
    }

    public function help(BotMan $bot)
    {
        $this->handleUser($bot);
        if(!$this->messageSentToBot($bot)) {
            return;
        }
        $message = OutgoingMessage::create('The rules for the games are a bit too long to post on slack.. so here is a link: https://liarsapp.valentin.nu/help');
        $bot->say($message, $this->user->slack_id);
{'fraction_non_alphanumeric': 0.161546723952739, 'fraction_numerical': 0.006015037593984963, 'mean_word_length': 2.5353075170842825, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 2, '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': '3009945', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1483, 'n_words': 286}