-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
48 lines (40 loc) · 958 Bytes
/
Copy pathindex.php
File metadata and controls
48 lines (40 loc) · 958 Bytes
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
42
43
44
45
46
47
48
<?php
/**
* @file
* Activate the bot.
*/
// Change default to your bot.
$botname = 'example';
// Do not modify --START--
// Prefer bot passed as argument.
if (isset($argv[1])) {
$botname = $argv[1];
}
// Define project root.
define('INDEX_ROOT', __DIR__);
// Check if the bot exists.
$bots = glob(INDEX_ROOT . '/bots/*' , GLOB_ONLYDIR);
$botnames = array();
foreach ($bots as $key => $bot) {
$botnames[] = basename($bot);
}
if (!in_array($botname, $botnames)) {
echo "No bot with name " . $botname . " found." . PHP_EOL;
return;
}
// Name the bot to activate.
define('BOT_NAME', $botname);
// Include files.
include_once(INDEX_ROOT.'/vendor/autoload.php');
// Workaround until psr-4 is implemented.
include_once(INDEX_ROOT.'/src/irc/connect/irc.connect.net_smartirc.php');
// Connect to IRC.
try
{
new IRC_Connect_Net_SmartIRC(BOT_NAME);
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
// Do not modify --END--