- bot_irc_msg_query in contributions/bot/bot.module
- All responses are available via a query.
bot_irc_msg_channel($data, $from_query = FALSE)Framework related messages and features.
$data The regular $data object prepared by the IRC library.
$from_query Boolean; whether this was a queried request.
contributions/bot/bot.module, line 68
<?php
function bot_irc_msg_channel($data, $from_query = FALSE) {
$to = $from_query ? $data->nick : $data->channel;
$addressed = bot_name_regexp();
// our IRC help interface which piggybacks off of Drupal's hook_help().
if (preg_match("/^${addressed}help\s*([^\?]*)\s*\??/i", $data->message, $help_matches)) {
if (!$help_matches[2]) { // no specific help was asked for so give 'em a list.
$irc_features = array_filter(module_invoke_all('help', 'irc:features', NULL));
asort($irc_features); // alphabetical listing of features. the chainsaw is family.
bot_message($to, t('Detailed information is available by asking for "help <feature>" where <feature> is one of: !features.', array('!features' => implode(', ', $irc_features))));
}
else { // a specific type of help was required, so load up just that bit of text.
$feature_name = 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($help_matches[2])));
$feature_help = array_filter(module_invoke_all('help', $feature_name, NULL));
bot_message($to, array_shift($feature_help));
}
}
}
?>