コード例 #1
0
ファイル: api.php プロジェクト: WingLim/TieBaRobot
function talk($content, $name, $api, $apikey = '')
{
    $content = str_ireplace("@{$name}", '', $content);
    $content = str_ireplace("回复 {$name} :", '', $content);
    $content = urlencode($content);
    switch ($api) {
        case 'xiaoji':
            $re = xiaoji($content);
            break;
        case 'xiaoi3':
            $re = xiaoi3($content);
            break;
        case 'tuling':
            $re = tuling($content, $apikey);
            break;
        case 'simsimi3':
            $re = simsimi3($content);
            break;
        case 'simsimi':
            $re = simsimi($content);
            break;
        default:
            $re = xiaoji($content);
    }
    return $re;
}
コード例 #2
0
ファイル: api.php プロジェクト: crushway/TieBaRobot
function talk($content, $name, $api, $apikey = '')
{
    $content = preg_replace("/@{$name}\\s*?|回复(\\s|@)*?{$name}\\s*?(:|:)/i", '', $content);
    $content = urlencode($content);
    $re = '';
    switch ($api) {
        case 'xiaoji':
            $re = xiaoji($content);
            break;
        case 'xiaoi3':
            $re = xiaoi3($content);
            break;
        case 'tuling':
            $re = tuling($content, $apikey);
            break;
        case 'simsimi3':
            $re = simsimi3($content);
            break;
        case 'simsimi':
            $re = simsimi($content);
            break;
        case 'baidurobot':
            $re = baidurobot($content, $apikey);
            break;
        default:
            $re = xiaoji($content);
    }
    return $re;
}