Example #1
0
<?php

/**
 * This one sends console message to chat by given id.
 *
 * Use activechats.php to get currently open chat window. Then:
 * php send.php '<chat id>' your message
 *
 * @package     Skypebot
 * @subpackage  Engine
 * @author      Daniel Jeznach <*****@*****.**>
 */
require_once __DIR__ . '/../vendor/autoload.php';
use Skypebot\Chat;
use Skypebot\Error;
$chat = new Chat();
if (empty($argv[1])) {
    trigger_error(Error::ERR_NO_CHAT_ID, E_USER_ERROR);
}
$messageArray = array_slice($argv, 2);
if (empty($messageArray) || !is_array($messageArray)) {
    trigger_error(Error::ERR_NO_CHAT_MESSAGE, E_USER_ERROR);
}
$id = $argv[1];
$message = implode(' ', $messageArray);
$chat->sendMessage($id, $message);
Example #2
0
<?php

/**
 * Print chat ID of currently open chat window
 *
 * @package     Skypebot
 * @subpackage  Engine
 * @author      Daniel Jeznach <*****@*****.**>
 */
require_once __DIR__ . '/../vendor/autoload.php';
use Skypebot\Chat;
$chat = new Chat();
$ids = $chat->getActiveChats();
foreach ($ids as $id) {
    $property = $chat->getChatProperty($id, Chat::CHAT_PROP_FRIENDLYNAME);
    printf("%s\n", $property);
}
Example #3
0
<?php

/**
 * This one sends wypok suchar to chat by given id.
 * Use activechats.php to get currently open chat window
 *
 * @package     Skypebot
 * @subpackage  Engine
 * @author      Daniel Jeznach <*****@*****.**>
 */
require_once __DIR__ . '/../vendor/autoload.php';
use Skypebot\Chat;
use Wypok\Suchar;
if (empty($argv[1])) {
    fprintf(STDERR, "Usage:\nphp %s <chat_id>\n", $argv[0]);
    exit(1);
}
$id = $argv[1];
$chat = new Chat();
$wypokSuchar = new Suchar();
$suchar = $wypokSuchar->getSuchar();
if ($suchar) {
    echo $suchar;
    $chat->sendMessage($id, $suchar);
}