Exemplo n.º 1
0
}
require_once PHP_DISCORD_DIR . "/library/auth.class.php";
require_once PHP_DISCORD_DIR . "/library/messages.class.php";
require_once PHP_DISCORD_DIR . "/library/actions.class.php";
$auth = new auth("*****@*****.**", "judahthebad1");
$messages = new messages("0ZFgG6Y9m9xi6SEX", $auth->token);
$actions = new actions();
$messages->send_message("UOLTT Bot Online!");
$messages->get_new_messages(1);
while (true) {
    if (sizeof($messages->message_que) > 0) {
        while ($messages->have_message()) {
            if ($messages->message['content'] == "~offline" && $messages->message['author']['username'] == "judahnator") {
                break 2;
            }
            $action = $actions->a_do($messages->message);
            if ($action) {
                // if response was given
                $messages->send_message($actions->output, $actions->mentions);
                echo $actions->output . " being sent to " . implode(",", $actions->mentions) . "\r\n";
            } else {
                // echo to console message if no action was taken
                if ($messages->message['author']['username'] != "UOLTT Bot") {
                    echo $messages->current_channel . " " . $messages->message['content'] . "\r\n";
                }
            }
        }
    }
    $messages->get_new_messages(5);
}
$messages->send_message("UOLTT Bot going offline!");