Sponsor-Board.de

Normale Version: ts3phpbot HELP !!
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Moinsen,

ich habe versucht heute schon seit 1 Std den bot zu installen und das ding geht als und als nicht ...

Howtos gibt es keine wie man den richtig installt ....

Die phpts3bot CFG:

Code:
#!/usr/bin/php
<?php
date_default_timezone_set('UTC');
spl_autoload_register('autoload');

function autoload($className) {
    $spacerPos = strpos($className, '_');
    if ($spacerPos !== false) {
        $prefix = substr($className, 0, $spacerPos);
        switch ($prefix) {
            case 'System':
                $newClassName = substr($className, 6);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/System' .  str_replace('_', '/', $newClassName).'.php';
            break;
            case 'TeamSpeak3':
                $newClassName = substr($className, 10);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TeamSpeak3' .  str_replace('_', '/', $newClassName).'.php';    
            break;
            case 'TS3Bot':
                $newClassName = substr($className, 6);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TS3Bot' .  str_replace('_', '/', $newClassName).'.php';    
            break;
            default:
                return;
            break;
        }
    } else {
        if ($className == 'TeamSpeak3') {
            $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TeamSpeak3/' .  $className .'.php';
        } elseif ($className == 'TS3PHPBot') {
            $newClassName = addDirectorySeperator(dirname(__FILE__)) . 'class/' .  $className .'.php';
        } else {
            return;
        }
    }    
    if (file_exists($newClassName)) {
        require_once $newClassName;
    }
}

function addDirectorySeperator($path) {
    $retval = $path;
    if (substr($retval, strlen($retval), 1) != DIRECTORY_SEPARATOR) {
        $retval .= DIRECTORY_SEPARATOR;
    }
    return $retval;
}

function printHelp() {
    $basename = basename(__FILE__);
    echo "Usage: " . $basename . " -d=<ini file> -g=<ini file> -c=<ini file> [-s|-p|-r]\n";
    echo str_pad(" ", 7, " ", STR_PAD_LEFT) . $basename . " -h\n\n";
    echo str_pad("-d <ini file>", 15, " " , STR_PAD_RIGHT) . "specifies the daemon config file\n";    
    echo str_pad("-g <ini file>", 15, " " , STR_PAD_RIGHT) . "specifies the global config file\n";
    echo str_pad("-c <ini file>", 15, " ", STR_PAD_RIGHT) . "specifies the plugin config file\n";
    echo str_pad("-s", 15, " ", STR_PAD_RIGHT) . "start the bot\n";
    echo str_pad("-p", 15, " ", STR_PAD_RIGHT) . "stop the bot\n";
    echo str_pad("-r", 15, " ", STR_PAD_RIGHT) . "reload the config\n";
    exit(0);
}

function printError($string) {
    fwrite(STDERR, date('r') . "\tTS3PHPBot:\t" . "[EMERG]\t" . $string . "\n");
    exit(1);
}

if (($argc < 2) || ($argc > 5)) {
    printHelp();
}

$options = getopt('g:c:d:hspr');
foreach ($options as $key => $value) {
    $options[$key] = ltrim($value, '=');
}

if (array_key_exists('h', $options)) {
    printHelp();
}

if (!array_key_exists('d', $options)) {
    printError('required parameter -d not specified');
}

if (!array_key_exists('g', $options)) {
    printError('required parameter -g not specified');
}

if (!array_key_exists('c', $options)) {
    printError('required parameter -c not specified');
}

if ((!is_readable($options['g'])) || (!is_file($options['g']))) {
    printError('global config file "' . $options['g'] . '" not readable - file exists?');
}

if ((!is_readable($options['d'])) || (!is_file($options['d']))) {
    printError('daemon config file "' . $options['d'] . '" not readable - file exists?');
}

if ((!is_readable($options['c'])) || (!is_file($options['c']))) {
    printError('plugin config file "' . $options['c'] . '" not readable - file exists?');
}

try {
    if (array_key_exists('s', $options)) {
        // start the bot
        TS3PHPBot::start(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']), new TS3Bot_IniFile($options['g']));
        exit(0);
    }
    
    if (array_key_exists('p', $options)) {
        // stop the bot
        TS3PHPBot::stop(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']));
        exit(0);
    }
    
    if (array_key_exists('r', $options)) {
        // reload the config
        TS3PHPBot::reload(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']), new TS3Bot_IniFile($options['g']));
        exit(0);
    }
} catch (Exception $e) {
    printError($e->getMessage());
}


Mein fehler der immer kommt ist

Code:
bot2@test:~/ts3phpbot$
bot2@test:~/ts3phpbot$ ./ts3phpbot_startscript.sh start
./ts3phpbot_startscript.sh: ./ts3phpbot.php: /usr/bin/php: bad interpreter: No such file or directory
bot2@test:~/ts3phpbot$


ich habe auch schon mal die erste zeile geändert in

Code:
#!/usr/bin/php-config5

also so dan:

Code:
#!/usr/bin/php-config5
<?php
date_default_timezone_set('UTC');
spl_autoload_register('autoload');

function autoload($className) {
    $spacerPos = strpos($className, '_');
    if ($spacerPos !== false) {
        $prefix = substr($className, 0, $spacerPos);
        switch ($prefix) {
            case 'System':
                $newClassName = substr($className, 6);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/System' .  str_replace('_', '/', $newClassName).'.php';
            break;
            case 'TeamSpeak3':
                $newClassName = substr($className, 10);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TeamSpeak3' .  str_replace('_', '/', $newClassName).'.php';    
            break;
            case 'TS3Bot':
                $newClassName = substr($className, 6);
                $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TS3Bot' .  str_replace('_', '/', $newClassName).'.php';    
            break;
            default:
                return;
            break;
        }
    } else {
        if ($className == 'TeamSpeak3') {
            $newClassName =  addDirectorySeperator(dirname(__FILE__)) . 'class/TeamSpeak3/' .  $className .'.php';
        } elseif ($className == 'TS3PHPBot') {
            $newClassName = addDirectorySeperator(dirname(__FILE__)) . 'class/' .  $className .'.php';
        } else {
            return;
        }
    }    
    if (file_exists($newClassName)) {
        require_once $newClassName;
    }
}

function addDirectorySeperator($path) {
    $retval = $path;
    if (substr($retval, strlen($retval), 1) != DIRECTORY_SEPARATOR) {
        $retval .= DIRECTORY_SEPARATOR;
    }
    return $retval;
}

function printHelp() {
    $basename = basename(__FILE__);
    echo "Usage: " . $basename . " -d=<ini file> -g=<ini file> -c=<ini file> [-s|-p|-r]\n";
    echo str_pad(" ", 7, " ", STR_PAD_LEFT) . $basename . " -h\n\n";
    echo str_pad("-d <ini file>", 15, " " , STR_PAD_RIGHT) . "specifies the daemon config file\n";    
    echo str_pad("-g <ini file>", 15, " " , STR_PAD_RIGHT) . "specifies the global config file\n";
    echo str_pad("-c <ini file>", 15, " ", STR_PAD_RIGHT) . "specifies the plugin config file\n";
    echo str_pad("-s", 15, " ", STR_PAD_RIGHT) . "start the bot\n";
    echo str_pad("-p", 15, " ", STR_PAD_RIGHT) . "stop the bot\n";
    echo str_pad("-r", 15, " ", STR_PAD_RIGHT) . "reload the config\n";
    exit(0);
}

function printError($string) {
    fwrite(STDERR, date('r') . "\tTS3PHPBot:\t" . "[EMERG]\t" . $string . "\n");
    exit(1);
}

if (($argc < 2) || ($argc > 5)) {
    printHelp();
}

$options = getopt('g:c:d:hspr');
foreach ($options as $key => $value) {
    $options[$key] = ltrim($value, '=');
}

if (array_key_exists('h', $options)) {
    printHelp();
}

if (!array_key_exists('d', $options)) {
    printError('required parameter -d not specified');
}

if (!array_key_exists('g', $options)) {
    printError('required parameter -g not specified');
}

if (!array_key_exists('c', $options)) {
    printError('required parameter -c not specified');
}

if ((!is_readable($options['g'])) || (!is_file($options['g']))) {
    printError('global config file "' . $options['g'] . '" not readable - file exists?');
}

if ((!is_readable($options['d'])) || (!is_file($options['d']))) {
    printError('daemon config file "' . $options['d'] . '" not readable - file exists?');
}

if ((!is_readable($options['c'])) || (!is_file($options['c']))) {
    printError('plugin config file "' . $options['c'] . '" not readable - file exists?');
}

try {
    if (array_key_exists('s', $options)) {
        // start the bot
        TS3PHPBot::start(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']), new TS3Bot_IniFile($options['g']));
        exit(0);
    }
    
    if (array_key_exists('p', $options)) {
        // stop the bot
        TS3PHPBot::stop(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']));
        exit(0);
    }
    
    if (array_key_exists('r', $options)) {
        // reload the config
        TS3PHPBot::reload(new TS3Bot_IniFile($options['d']), new TS3Bot_IniFile($options['c']), new TS3Bot_IniFile($options['g']));
        exit(0);
    }
} catch (Exception $e) {
    printError($e->getMessage());
}

aber dan kommt immer der Error:

Code:
bot2@test:~/ts3phpbot$
bot2@test:~/ts3phpbot$ ./ts3phpbot_startscript.sh start
./ts3phpbot.php: line 2: ?php: No such file or directory
./ts3phpbot.php: line 3: syntax error near unexpected token `'UTC''
./ts3phpbot.php: line 3: `date_default_timezone_set('UTC');'
bot2@test:~/ts3phpbot$



kann mir bitte mal jemand helfen heute so ab 12 Uhr ?? oder kennst sich mit dem bot jemand sehr gut aus ???

sry muss of gewitter -_- des todes bei uns -_-

Würde sagen es fehlt dir das cli. Mache bitte folgendes:

apt-get install php5-cli

sollte eigentlich schon die Lösung sein
ok danke das war es !!!

Closen Bitte danke!!
Referenz-URLs