IRC-Bot

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • hallo alle zusammen,

    ich hab schon mal nach einen PHP-Bot für IRC gegoogelt, aber der will nicht bei mir laufen, vielleicht kann mir einer von euch helfen:

    Fehlermeldung

    Warning: fsockopen() has been disabled for security reasons in /usr/export/www/vhosts/funnetwork/hosting/yaroc/Bot/bot.php on line 20
    Can't connect to irc.quakenet.org


    Script:

    Quellcode

    1. <?PHP
    2. function cmd($cmd) {
    3. global $fp;
    4. fputs($fp,$cmd);
    5. echo "-> $cmd\r\n";
    6. }
    7. $config['server'] = 'irc.quakenet.org';
    8. $config['port'] = 6668;
    9. $config['nick'] = 'troubleD[2]';
    10. $config['anick'] = 'troubleD[2]';
    11. $config['name'] = 'troubleD[2]';
    12. $config['email'] = '';
    13. $config['ident'] = 'troubleD[2]';
    14. $config['identd'] = false;
    15. $config['useemailasident'] = true;
    16. $config['channels'][] = "#GdK";
    17. $users['admin'][0] = "";
    18. $raws = array(motd => array('001','002','003','004','005','251','252','253','254','255','372','375','376'));
    19. $fp = fsockopen($config['server'],$config['port']) OR
    20. die("Can't connect to {$config['server']}.");
    21. $firstConnect = true;
    22. cmd("USER {$config['nick']} {$config['nick']} {$config['nick']} :{$config['nick']}\r\n");
    23. cmd("NICK {$config['nick']}\r\n");
    24. while (!feof($fp)) {
    25. $buffer = fgets($fp, 4096);
    26. $line = explode(' ', $buffer);
    27. for ($c = 0;$c <= count($line)-1;$c++) {
    28. $line[$c] = trim($line[$c],"\r\n");
    29. }
    30. if ($line[0] == 'PING') {
    31. cmd("PONG $line[1]\r\n");
    32. }
    33. if (!in_array($line[1],$raws['motd'])) {
    34. echo "<- ".implode(' ',$line)."\r\n";
    35. }
    36. if ($line[1] == '376') {
    37. foreach($config['channels'] as $chan) {
    38. cmd("JOIN $chan\r\n");
    39. }
    40. }
    41. elseif ($line[1] == 'PRIVMSG') {
    42. if (in_array(substr($line[0],1),$users['admin'])) {
    43. if ($line[3] == ":!lol") {
    44. cmd("PRIVMSG {$line[2]} :loOoOoOoOol!\n");
    45. }
    46. elseif ($line[3] == ":!quit") {
    47. cmd("QUIT :AS YOU WISH!!1111!1!1\n");
    48. }
    49. elseif ($line[3] == ":!join") {
    50. cmd("JOIN :{$line[4]}\n");
    51. }
    52. elseif ($line[3] == ":!part") {
    53. cmd("PART :{$line[2]}\n");
    54. }
    55. elseif ($line[3] == ":!hop") {
    56. cmd("PART :{$line[2]}\n");
    57. usleep(500);
    58. cmd("JOIN :{$line[2]}\n");
    59. }
    60. }
    61. }
    62. }
    Alles anzeigen



    ich bedanke mich schon mal im Vorraus.