enanobot.php
author Dan
Thu, 04 Dec 2008 19:40:27 -0500
changeset 29 300f673fbbdc
parent 23 df31a3872d19
child 30 2cfcd2801e5a
permissions -rw-r--r--
Added web interface for IP logger module; set display_errors to on in PHP
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
     1
<?php
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
     2
/**
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
     3
 * EnanoBot - the Enano CMS IRC logging and help automation bot
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
     4
 * GPL and no warranty, see the LICENSE file for more info
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
     5
 */
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
     6
7
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
     7
// parse command line
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
     8
if ( isset($argv[1]) )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
     9
{
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    10
  $arg =& $argv[1];
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    11
  if ( $arg == '--daemon' || $arg == '-d' )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    12
  {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    13
    // attempt to fork...
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    14
    if ( function_exists('pcntl_fork') )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    15
    {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    16
      $pid = pcntl_fork();
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    17
      if ( $pid == -1 )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    18
      {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    19
        echo "Forking process failed.\n";
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    20
        exit(1);
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    21
      }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    22
      else if ( $pid )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    23
      {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    24
        echo "EnanoBot daemon started, pid $pid\n";
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    25
        exit(0);
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    26
      }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    27
      else
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    28
      {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    29
        // do nothing, just continue.
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    30
      }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    31
    }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    32
    else
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    33
    {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    34
      echo "No pcntl support in PHP, continuing in foreground\n";
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    35
    }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    36
  }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    37
  else if ( $arg == '-v' || $arg == '--verbose' )
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    38
  {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    39
    define('LIBIRC_DEBUG', '');
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    40
  }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    41
  else
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    42
  {
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    43
    echo <<<EOF
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    44
Usage: {$argv[0]}
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    45
Options:
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    46
  -d, --daemon     Run in background (requires pcntl support)
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    47
  -v, --verbose    Log communication to stdout (ignored if -d specified)
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    48
  -h, --help       This help message
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    49
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    50
EOF;
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    51
    exit(1);
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    52
  }
1d6e762433fe Added daemonizing (forking) support.
Dan
parents: 6
diff changeset
    53
}
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
    54
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    55
$censored_words = array('cock', 'fuck', 'cuck', 'funt', 'cunt', 'bitch');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    56
$_shutdown = false;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    57
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    58
function eb_censor_words($text)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    59
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    60
  // return $text;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    61
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    62
  global $censored_words;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    63
  foreach ( $censored_words as $word )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    64
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    65
    $replacement = substr($word, 0, 1) . preg_replace('/./', '*', substr($word, 1));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    66
    while ( stristr($text, $word) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    67
    {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    68
      $text = preg_replace("/$word/i", $replacement, $text);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    69
    }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    70
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    71
  return $text;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    72
}
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    73
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    74
require('libirc.php');
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    75
require('hooks.php');
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    76
require('config.php');
23
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
    77
require('database.php');
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    78
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    79
@ini_set('display_errors', 'on');
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    80
error_reporting(E_ALL);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    81
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    82
// load modules
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    83
foreach ( $modules as $module )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    84
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    85
  $modulefile = "modules/$module.php";
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    86
  if ( file_exists($modulefile) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    87
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    88
    require($modulefile);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    89
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    90
}
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    91
23
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
    92
mysql_reconnect();
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    93
23
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
    94
eval(eb_fetch_hook('startup_early'));
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    95
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
    96
$libirc_channels = array();
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
    97
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
    98
$irc = new Request_IRC($server);
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
    99
$irc->connect($nick, $user, $name, $pass);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   100
$irc->set_privmsg_handler('enanobot_privmsg_event');
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   101
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   102
foreach ( $channels as $channel )
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   103
{
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   104
  $libirc_channels[$channel] = $irc->join($channel, 'enanobot_channel_event');
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   105
  $channel_clean = preg_replace('/^[#&]/', '', $channel);
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   106
  $libirc_channels[$channel_clean] =& $libirc_channels[$channel];
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   107
  $irc->privmsg('ChanServ', "OP $channel $nick");
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   108
}
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   109
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   110
$irc->event_loop();
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   111
$irc->close();
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   112
mysql_close($mysql_conn);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   113
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   114
function enanobot_channel_event($sockdata, $chan)
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   115
{
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   116
  global $irc, $nick, $mysql_conn, $privileged_list;
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   117
  $sockdata = trim($sockdata);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   118
  $message = Request_IRC::parse_message($sockdata);
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   119
  $channelname = $chan->get_channel_name();
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   120
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   121
  eval(eb_fetch_hook('event_raw_message'));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   122
  
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   123
  switch ( $message['action'] )
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   124
  {
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   125
    case 'JOIN':
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   126
      eval(eb_fetch_hook('event_join'));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   127
      break;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   128
    case 'PART':
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   129
      eval(eb_fetch_hook('event_part'));
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   130
      break;
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   131
    case 'PRIVMSG':
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   132
      enanobot_process_channel_message($sockdata, $chan, $message);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   133
      break;
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   134
  }
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   135
}
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   136
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   137
function enanobot_process_channel_message($sockdata, $chan, $message)
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   138
{
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   139
  global $irc, $nick, $mysql_conn, $privileged_list;
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   140
  
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   141
  if ( strpos($message['message'], $nick) && !in_array($message['nick'], $privileged_list) && $message['nick'] != $nick )
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   142
  {
9
4192954c29d1 Finalization of merge from devel branch
Dan
parents: 8
diff changeset
   143
    $target_nick =& $message['nick'];
13
f073c94a1477 Disabled annoying "I'm only a bot" message
Dan
parents: 9
diff changeset
   144
    // $chan->msg("{$target_nick}, I'm only a bot. :-) You should probably rely on the advice of humans if you need further assistance.", true);
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   145
  }
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   146
  else
1
739423b66116 Added support for logging mode messages and join/part messages
Dan
parents: 0
diff changeset
   147
  {
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   148
    eval(eb_fetch_hook('event_channel_msg'));
1
739423b66116 Added support for logging mode messages and join/part messages
Dan
parents: 0
diff changeset
   149
  }
739423b66116 Added support for logging mode messages and join/part messages
Dan
parents: 0
diff changeset
   150
}
739423b66116 Added support for logging mode messages and join/part messages
Dan
parents: 0
diff changeset
   151
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   152
function enanobot_privmsg_event($message)
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   153
{
6
a802bb5b3e08 Made the channel list completely dynamic now
Dan
parents: 4
diff changeset
   154
  global $privileged_list, $irc, $nick;
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   155
  static $part_cache = array();
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   156
  if ( in_array($message['nick'], $privileged_list) && $message['message'] == 'Suspend' && $message['action'] == 'PRIVMSG' )
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   157
  {
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   158
    foreach ( $irc->channels as $channel )
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   159
    {
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   160
      $part_cache[] = array($channel->get_channel_name(), $channel->get_handler());
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   161
      $channel->msg("I've received a request from {$message['nick']} to stop responding to requests, messages, and activities. Don't forget to unsuspend me with /msg $nick Resume when finished.", true);
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   162
      $channel->part("Logging and presence suspended by {$message['nick']}", true);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   163
    }
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   164
  }
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   165
  else if ( in_array($message['nick'], $privileged_list) && $message['message'] == 'Resume' && $message['action'] == 'PRIVMSG' )
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   166
  {
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   167
    global $nick;
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   168
    foreach ( $part_cache as $chan_data )
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   169
    {
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   170
      $chan_name = substr($chan_data[0], 1);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   171
      $GLOBALS[$chan_name] = $irc->join($chan_data[0], $chan_data[1]);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   172
      $GLOBALS[$chan_name]->msg("Bot resumed by {$message['nick']}.", true);
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   173
      $irc->privmsg('ChanServ', "OP {$chan_data[0]} $nick");
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   174
    }
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   175
    $part_cache = array();
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   176
  }
23
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
   177
  else if ( in_array($message['nick'], $privileged_list) && preg_match('/^Shutdown(?: (.+))$/i', $message['message'], $match) && $message['action'] == 'PRIVMSG' )
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   178
  {
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   179
    $GLOBALS['_shutdown'] = true;
23
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
   180
    $quitmessage = empty($match[1]) ? "Remote bot shutdown ordered by {$message['nick']}" : $match[1];
df31a3872d19 Made error handling for MySQL better; added ability to use custom shutdown messages
Dan
parents: 13
diff changeset
   181
    $irc->close($quitmessage, true);
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   182
    return 'BREAK';
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   183
  }
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   184
  else if ( $message['action'] == 'PRIVMSG' )
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   185
  {
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   186
    eval(eb_fetch_hook('event_privmsg'));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   187
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   188
  else
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   189
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   190
    eval(eb_fetch_hook('event_other'));
0
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   191
  }
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   192
}
d02690a8552c Initial population. EnanoBot v0.1.
Dan
parents:
diff changeset
   193
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   194
if ( $_shutdown )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   195
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   196
  exit(2);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents: 7
diff changeset
   197
}