public function run() { $line = new ReceivedLine($this->runMessage); $line->parse(); $user = UserManager::get($this->senderNick); $db = Database::getInstance(); $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, message, time) VALUES (?,?,?,?,?,?,?)"); $stmt->execute(array(ReceivedLineTypes::CHANMSG, $this->senderNick, $user->host, $user->ident, $this->channel, $line->message, time())); }
public function run() { $user = UserManager::get($this->senderNick); if (!$user->nickname) { $user = UserManager::get($this->targetNick); } $channels = ChannelManager::getCommonChannels($this->senderNick); if (!$channels) { $channels = ChannelManager::getCommonChannels($this->targetNick); } $db = Database::getInstance(); foreach ($channels as $channel) { $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, target_nick, time, message) VALUES (?,?,?,?,?,?,?,?)"); $stmt->execute(array(ReceivedLineTypes::NICK, $this->senderNick, $user->host, $user->ident, $channel, $this->targetNick, time(), "changed nick to " . $this->target_nick)); } }
use awesomeircbot\event\Event; use awesomeircbot\trigger\Trigger; use awesomeircbot\database\Database; error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); passthru('clear'); echo "Welcome to Awesome IRC Bot v2\n"; echo "Created by AwesomezGuy, follow @AwesomezGuy on Twitter\n"; if (Config::$die) { die("READ THE CONFIG!\n\n"); } if (Config::$configVersion != 4) { die("Your config is out of date, please delete your old config and remake your config from config.example.php\n\n"); } ModuleManager::initialize(); $server = Server::getInstance(); $db = Database::getInstance(); $db->updateScriptArrays(); $db->updateDatabase(); echo "\n"; while (true) { // Connect $server->connect(); // Identify $server->identify(); sleep(1); // NickServ if (Config::$nickservPassword) { $server->identifyWithNickServ(); } // Loop through the channels in the config and join them foreach (Config::$channels as $channel) {
/** * Act, (/me) a message, same syntax as the message() * method */ public function act($target, $message) { // Send it ErrorLog::log(ErrorCategories::DEBUG, "Messaging '" . $target . "' with message '" . $message . "' formatted as an ACTION (/me)"); fwrite(static::$serverHandle, "PRIVMSG " . $target . " :" . chr(1) . "ACTION " . $message . chr(1) . "\n"); // Log it (if chan) if (strpos($target, "#") !== false) { $db = Database::getInstance(); $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, ident, channel_name, message, time) VALUES (?,?,?,?,?,?)"); $stmt->execute(array(ReceivedLineTypes::CHANMSG, Config::getRequiredValue("nickname"), Config::getRequiredValue("username"), $target, "ACTION " . $message, time())); } }