Example #1
0
<?php

PluginSet("Show help", null, false);
$plugin_list = HELP_BEGIN . "\n";
foreach ($plugins as $value) {
    if ($value['visible'] == True) {
        $plugin_list .= "\n" . $value['desc'];
    }
}
$plugin_list .= "\n\n" . HELP_END;
$BOT->msg($from, $plugin_list);
Example #2
0
<?php

PluginSet("Echo what you typed.");
$BOT->msg($plugin_sendto, $plugin_text);
Example #3
0
<?php

PluginSet("Let me google that for you.");
$msg = "Let me google that for you.";
$msg .= "\n\nStep 1. Open the Google.com";
$msg .= "\nStep 2. Type in your question";
$msg .= "\nStep 3. Click the search button";
$msg .= "\nWas that so hard?";
$msg .= "\n\nhttps://www.google.com/search?q=" . rawurlencode($plugin_text);
//$msg .=  "\n\nhttp://lmgtfy.com/?q=".rawurlencode($plugin_text);
$BOT->msg($plugin_sendto, $msg);
Example #4
0
<?php

PluginSet("Find Somebody on WoW");
$plugin_wow_init = explode(' ', $plugin_text, 2);
$plugin_wow_api_url_prefix = "https://api.battlenet.com.cn/wow/";
$plugin_wow_realm = $plugin_wow_init[0];
$plugin_wow_characterName = $plugin_wow_init[1];
$plugin_wow_api_url_root = $plugin_wow_api_url_prefix . "character/" . $plugin_wow_realm . "/" . $plugin_wow_characterName;
$plugin_wow_profile = json_decode(file_get_contents($plugin_wow_api_url_root . "?fields=stats&apikey=" . PLUGIN_BATTLENET_KEY), true);
$plugin_wow_db_races = json_decode(file_get_contents($plugin_wow_api_url_prefix . "data/character/races?apikey=" . PLUGIN_BATTLENET_KEY), true);
$plugin_wow_db_classes = json_decode(file_get_contents($plugin_wow_api_url_prefix . "data/character/classes?apikey=" . PLUGIN_BATTLENET_KEY), true);
if (isset($plugin_wow_profile['lastModified']) and isset($plugin_wow_db_classes['classes']) and isset($plugin_wow_db_races['races'])) {
    foreach ($plugin_wow_db_races["races"] as $plugin_wow_db_races_list) {
        if ($plugin_wow_db_races_list["id"] == $plugin_wow_profile["race"]) {
            $plugin_wow_profile_race = $plugin_wow_db_races_list["name"];
        }
    }
    foreach ($plugin_wow_db_classes["classes"] as $plugin_wow_db_classes_list) {
        if ($plugin_wow_db_classes_list["id"] == $plugin_wow_profile["class"]) {
            $plugin_wow_profile_class = $plugin_wow_db_classes_list["name"];
        }
    }
    $plugin_wow_thumbnail = str_replace("avatar", "profilemain", "http://render-api-cn.worldofwarcraft.com/static-render/cn/" . $plugin_wow_profile['thumbnail']);
    $msg = "所在区服: " . $plugin_wow_profile["realm"] . " | " . "角色名称: " . $plugin_wow_profile["name"] . "\n" . "种族: " . $plugin_wow_profile_race . " | " . "职业: " . $plugin_wow_profile_class . "\n" . "等级: " . $plugin_wow_profile["level"] . " | " . "成就点数: " . $plugin_wow_profile["achievementPoints"] . "\n" . "预览图片: " . $plugin_wow_thumbnail . "\n\n" . "生命上限: " . $plugin_wow_profile["stats"]["health"] . " | " . "法力上限[" . $plugin_wow_profile["stats"]["powerType"] . "]: " . $plugin_wow_profile["stats"]["power"] . "\n" . "力量: " . $plugin_wow_profile["stats"]["str"] . " | " . "敏捷: " . $plugin_wow_profile["stats"]["agi"] . "\n" . "智力: " . $plugin_wow_profile["stats"]["int"] . " | " . "耐力: " . $plugin_wow_profile["stats"]["sta"] . "\n" . "\n详细资料: " . "http://www.battlenet.com.cn/wow/zh/character/" . urlencode($plugin_wow_realm) . "/" . urlencode($plugin_wow_characterName) . "/simple";
    $BOT->msg($plugin_sendto, $msg);
} else {
    $BOT->msg($plugin_sendto, 'Somthing happened.');
}
Example #5
0
<?php

PluginSet("tts", "Text To Speech");
$mp3 = file_get_contents("http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=" . urlencode($plugin_text));
$file = fopen($from . ".mp3", "w");
echo fwrite($file, $mp3);
fclose($file);
$BOT->send_audio($from, "/home/wwwroot/1.vps.dennx.com/" . $from . ".mp3");
//unlink($matches[1].".mp3");
Example #6
0
<?php

PluginSet("Punycode Encode & Decode.");
class Punycode
{
    private static $DECODE_TABLE = array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35);
    private static $ENCODE_TABLE = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    const BASE = 36;
    const TMIN = 1;
    const TMAX = 26;
    const SKEW = 38;
    const DAMP = 700;
    const INITIAL_BIAS = 72;
    const INITIAL_N = 0x80;
    const DELIMITER = '-';
    const PREFIX = 'xn--';
    const SUFFIX = '';
    private static $OPTIONS = array('charset' => 'UTF-8');
    public static function set_options($options)
    {
        self::$OPTIONS = array_merge(self::$OPTIONS, (array) $options);
    }
    private static function adapt($delta, $numpoints, $firsttime)
    {
        $delta = (int) ($firsttime ? $delta / self::DAMP : $delta / 2);
        $delta += (int) ($delta / $numpoints);
        $k = 0;
        while ($delta > (self::BASE - self::TMIN) * self::TMAX / 2) {
            $delta = (int) ($delta / (self::BASE - self::TMIN));
            $k += self::BASE;
        }
Example #7
0
<?php

PluginSet("Search Emoji");
$plugin_emoji_json = json_decode(file_get_contents("http://emoji.getdango.com/api/emoji?q=" . rawurlencode($plugin_text)), true);
$msg = '';
foreach ($plugin_emoji_json['results'] as $plugin_emoji_json_result) {
    $msg .= $plugin_emoji_json_result['text'] . " Score: " . $plugin_emoji_json_result['score'] . "\n";
}
$BOT->msg($plugin_sendto, substr($msg, 0, strlen($msg) - 1));
Example #8
0
<?php

PluginSet("Find Somebody on Steam");
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0');
if (strpos($plugin_text, "@") === 0) {
    $plugin_text = substr($plugin_text, 1);
}
$plugin_steam_steamid = json_decode(file_get_contents('http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=' . PLUGIN_STEAM_KEY . '&vanityurl=' . $plugin_text), true);
if ($plugin_steam_steamid['response']['success'] == 1) {
    $plugin_steam_steamid = $plugin_steam_steamid['response']['steamid'];
    $plugin_steam_PlayerSummaries = json_decode(file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . PLUGIN_STEAM_KEY . '&steamids=' . $plugin_steam_steamid), true);
    $plugin_steam_PlayerLevel = json_decode(file_get_contents('https://api.steampowered.com/IPlayerService/GetSteamLevel/v1?key=' . PLUGIN_STEAM_KEY . '&steamid=' . $plugin_steam_steamid), true);
    $plugin_steam_OwnedGames = json_decode(file_get_contents('https://api.steampowered.com/IPlayerService/GetOwnedGames/v1?include_played_free_games=1&include_appinfo=1&key=' . PLUGIN_STEAM_KEY . '&steamid=' . $plugin_steam_steamid), true);
    $plugin_steam_RecentlyPlayedGames = json_decode(file_get_contents('http://api.steampowered.com/IPlayerService/GetRecentlyPlayedGames/v1?key=' . PLUGIN_STEAM_KEY . '&steamid=' . $plugin_steam_steamid . "&count=1"), true);
    $personastate = $plugin_steam_PlayerSummaries['response']['players'][0]['personastate'];
    if ($personastate == 0) {
        $personastate = 'Offline (or Private) ';
    } elseif ($personastate == 1) {
        $personastate = 'Online';
    } elseif ($personastate == 2) {
        $personastate = 'Busy';
    } elseif ($personastate == 3) {
        $personastate = 'Away';
    } elseif ($personastate == 4) {
        $personastate = 'Snooze';
    } elseif ($personastate == 5) {
        $personastate = 'Looking to trade';
    } elseif ($personastate == 6) {
        $personastate = 'Looking to play';
    }
    if (array_key_exists('gameextrainfo', $plugin_steam_PlayerSummaries['response']['players'][0])) {
Example #9
0
<?php

PluginSet("translate");
$matches = explode(" ", $plugin_text, 2);
if (!isset($matches[1])) {
    $to = "en";
    $text = urlencode($matches[0]);
} elseif (isset($matches[1]) and strlen($matches[0]) != 2) {
    $to = "en";
    $text = urlencode($matches[0] . $matches[1]);
} else {
    $to = $matches[0];
    $text = urlencode($matches[1]);
}
$trans = file_get_contents('http://api.microsofttranslator.com/v2/ajax.svc/TranslateArray2?appId=%22TWQET6TO9c7Iw1yXOahFm8zfEzty5DUHuaTHkl5SCrHUPgu3ABP7aflbz8teet6IS%22&to="' . $to . '"&options={}&texts=["' . $text . '"]');
preg_match("/\\[{.*?\\}]/is", $trans, $trans_json);
$msg = "Result: " . json_decode($trans_json[0], true)[0]["TranslatedText"];
$BOT->msg($from, $msg);
Example #10
0
<?php

PluginSet("Change the form of IP address");
$arr = explode('.', $plugin_text);
$msg = 'IP: ' . $arr[0] . '.' . $arr[1] . '.' . $arr[2] . '.' . $arr[3];
$msg .= "\nint: " . ($arr[0] * pow(256, 3) + $arr[1] * pow(256, 2) + $arr[2] * 256 + $arr[3]);
$msg .= "\noct: 0" . decoct($arr[0]) . ".0" . decoct($arr[1]) . ".0" . decoct($arr[2]) . '.0' . decoct($arr[3]);
$msg .= "\nhex: 0x" . dechex($arr[0]) . ".0x" . dechex($arr[1]) . ".0x" . dechex($arr[2]) . '.0x' . dechex($arr[3]);
$msg .= "\nfucking hex: 0x0000000000" . dechex($arr[0]) . ".0x0000000000" . dechex($arr[1]) . ".0x0000000000" . dechex($arr[2]) . '.0x0000000000' . dechex($arr[3]);
$msg .= "\nYou can combine them with any combination. Such as: 0" . decoct($arr[0]) . '.0x0000000000' . dechex($arr[1]) . '.' . $arr[2] . '.0x' . dechex($arr[3]);
$BOT->msg($plugin_sendto, $msg);
Example #11
0
<?php

PluginSet("ipv4 Calculator.");
$var = explode('/', $plugin_text);
if (filter_var($var[0], FILTER_VALIDATE_IP)) {
    $arr = explode('.', $var[0]);
    $msg = 'Address: ' . $var[0];
    $Netmask_bin = str_repeat('1', $var[1]) . str_repeat('0', 32 - $var[1]);
    $Wildcard_bin = strtr($Netmask_bin, "10", "01");
    $msg .= "\nNetmask: " . bindec(substr($Netmask_bin, 0, 8)) . '.' . bindec(substr($Netmask_bin, 8, 8)) . '.' . bindec(substr($Netmask_bin, 16, 8)) . '.' . bindec(substr($Netmask_bin, 24, 8)) . ' or /' . $var[1];
    //$msg .= "\nWildcard: ".bindec(substr($Wildcard_bin, 0, 8)).'.'.bindec(substr($Wildcard_bin, 8, 8)).'.'.bindec(substr($Wildcard_bin, 16, 8)).'.'.bindec(substr($Wildcard_bin, 24, 8));
    $plugin_ipcalc_address_long = ip2long($var[0]);
    $plugin_ipcalc_nmask_long = ip2long(bindec(substr($Netmask_bin, 0, 8)) . '.' . bindec(substr($Netmask_bin, 8, 8)) . '.' . bindec(substr($Netmask_bin, 16, 8)) . '.' . bindec(substr($Netmask_bin, 24, 8)));
    $plugin_ipcalc_net = long2ip($plugin_ipcalc_address_long & $plugin_ipcalc_nmask_long);
    $plugin_ipcalc_host_first = ~$plugin_ipcalc_nmask_long & $plugin_ipcalc_address_long;
    $plugin_ipcalc_first = ($plugin_ipcalc_address_long ^ $plugin_ipcalc_host_first) + 1;
    $plugin_ipcalc_broadcast_invert = ~$plugin_ipcalc_nmask_long;
    $plugin_ipcalc_last = ($plugin_ipcalc_address_long | $plugin_ipcalc_broadcast_invert) - 1;
    $plugin_ipcalc_broadcast = long2ip($plugin_ipcalc_address_long | $plugin_ipcalc_broadcast_invert);
    if ($plugin_ipcalc_last < 0) {
        $plugin_ipcalc_last += 4294967296;
    }
    if ($plugin_ipcalc_first < 0) {
        $plugin_ipcalc_first += 4294967296;
    }
    $plugin_ipcalc_hosts = $plugin_ipcalc_last - $plugin_ipcalc_first;
    $msg .= "\nNetwork: " . $plugin_ipcalc_net;
    $msg .= "\nBroadcast: " . $plugin_ipcalc_broadcast;
    $msg .= "\nHostMin: " . long2ip($plugin_ipcalc_first);
    $msg .= "\nHostMax: " . long2ip($plugin_ipcalc_last);
    $msg .= "\nTotal num: " . ($plugin_ipcalc_hosts + 3);
Example #12
0
<?php

PluginSet("find someone on Github");
$opts = array('http' => array('header' => "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"));
if (strpos($plugin_text, "@") === 0) {
    $plugin_text = substr($plugin_text, 1);
}
if (!strpos($plugin_text, '/')) {
    $user = file_get_contents("https://api.github.com/users/" . urlencode($plugin_text) . '?access_token=' . PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
    $starred = file_get_contents("https://api.github.com/users/" . urlencode($plugin_text) . "/starred" . '?access_token=' . PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
    $user = json_decode($user, true);
    $msg = "ID:  @" . $user['login'];
    plugin_github_check("Type", $user['type']);
    plugin_github_check("Name", $user['name']);
    plugin_github_check("Email", $user['email']);
    plugin_github_check("Company", $user['company']);
    if (count(json_decode($starred, true)) == 30) {
        $starred = '>30';
    } else {
        $starred = count(json_decode($starred, true));
    }
    plugin_github_check("Starred", $starred);
    plugin_github_check("Repos", $user['public_repos']);
    plugin_github_check("Followers", $user['followers']);
    plugin_github_check("Following", $user['following']);
    @($msg .= "\nUrl: https://github.com/" . $user['login']);
} else {
    $repo = file_get_contents("https://api.github.com/repos/" . $plugin_text . '?access_token=' . PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
    $repo = json_decode($repo, true);
    $msg = "Name:  " . $repo['name'];
    plugin_github_check("Description", $repo['description']);
Example #13
0
<?php

PluginSet("Urban Dictionary");
$msg = $plugin_text;
$plugin_urbandict_raw = json_decode(file_get_contents("http://api.urbandictionary.com/v0/define?term=" . $plugin_text), true);
foreach ($plugin_urbandict_raw['list'] as $plugin_urbandict_sublist) {
    $msg .= "\n------------------\n" . $plugin_urbandict_sublist['definition'] . "\n\n" . $plugin_urbandict_sublist['permalink'];
}
$BOT->msg($plugin_sendto, $msg);