-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
41 lines (35 loc) · 2.02 KB
/
start.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once("Bot.php");
require_once("MyBot.php");
$con_data = new ConnectionData("irc.hackthissite.org"); // port is 6667 by default
$bot_data = new BotData("PHPBot", "No Pass", "PHPBot", "PHP Bot", array("#bots"));
$bot = new MyBot($con_data, $bot_data);
$bot->register_response_method(new ResponseMethod("pong", "PING", 0));
$bot->register_response_method(new ResponseMethod("random_nick", (string)ERR_NICKNAMEINUSE, 0));
$bot->register_response_method(new ResponseMethod("join_chans", (string)RPL_ENDOFMOTD, 0));
$bot->register_response_method(new ResponseMethod("ask_for_unban", (string)ERR_BANNEDFROMCHAN, 0));
// PRIVMSG BotNick CMD args
$bot->register_response_method(new ResponseMethod("help", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("irc_die", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("leave", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("recon", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("say", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("wisdom", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("change_nick", "PRIVMSG", 100));
// PRIVMSG #room BotNick CMD args
$bot->register_response_method(new ResponseMethod("help_2", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("irc_die_2", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("leave_2", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("recon_2", "PRIVMSG", 100));
$bot->register_response_method(new ResponseMethod("say_2", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("wisdom_2", "PRIVMSG", 0));
$bot->register_response_method(new ResponseMethod("change_nick_2", "PRIVMSG", 100));
if(!$bot->connect() || !$bot->log_in()){
print_r($bot->get_errors());
exit("Failed to connect or failed to log in.");
}
while($bot->is_connected){
$raw_data = $bot->get_server_data();
$parsed_data = $bot->parse_server_data($raw_data);
$bot->respond($parsed_data);
}