Ejemplo n.º 1
0
	protected function caps(Bot $bot) {
		if (!isset($this->caps[$bot->message['usernameraw']])) {
			$this->caps[$bot->message['usernameraw']] = array('kills' => 0, 'counter' => 0, 'lastreset' => 0);
		}
		if ($this->caps[$bot->message['usernameraw']]['lastreset'] < (time() - 3600)) {
			if ($this->caps[$bot->message['usernameraw']]['kills'] > 0) $this->caps[$bot->message['usernameraw']]['kills']--;
		}
		if ($this->caps[$bot->message['usernameraw']]['lastreset'] < (time() - 120)) {
			if ($this->caps[$bot->message['usernameraw']]['counter'] > 0) $this->caps[$bot->message['usernameraw']]['counter']--;
			$this->caps[$bot->message['usernameraw']]['lastreset'] = time();
		}
		
		$capscount = 0;
		// don't count whitespace
		$message = preg_replace('~[\s!?\.]~', '', $bot->message['text']);
		$charcount = strlen($message);
		$chars = str_split($bot->message['text']);
		foreach ($chars as $char) {
			if (preg_match('~[A-Z]~', $char)) $capscount++;
		}

		if (strlen($message) < 6 || ($capscount / $charcount * 100) < $this->config->config['capspercent']) return;
		
		$this->caps[$bot->message['usernameraw']]['counter']++;
		$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->antispam_no_caps);
		if ($this->caps[$bot->message['usernameraw']]['counter'] > 2) {
			$this->caps[$bot->message['usernameraw']]['counter'] = 0;
			$bot->queue('/tmute '.$bot->message['usernameraw'].' '.pow(2, $this->caps[$bot->message['usernameraw']]['kills']++));
		}
	}
Ejemplo n.º 2
0
	private function __construct() {
		self::init();
		self::$log = new Log();
		self::log()->info = 'Starting, PID is '.getmypid();
		if (VERBOSE > 5) {
			self::log()->info = '         (__) ';
			self::log()->info = '         (oo) ';
			self::log()->info = '   /------\/ ';
			self::log()->info = '  / |    ||   ';
			self::log()->info = ' *  /\---/\ ';
			self::log()->info = '    ~~   ~~   ';
			self::log()->info = '...."Have you mooed today?"...';
		}
		self::$config = new Config();
		self::$permission = new Permission();
		self::$language = new Language(LANGUAGE);
		if (VERBOSE > 0) self::log()->info = 'Loaded Config';
		self::$bot = new Bot();
		
		$modules = self::config()->config['modules'];
		// load default modules
		if (VERBOSE > 0) self::log()->info = 'Loading Modules';
		foreach ($modules as $module) {
			self::loadModule($module);
		}
		self::bot()->work();
	}
Ejemplo n.º 3
0
	public function handle(Bot $bot) {
		if ($bot->message['id'] % 500 == 0) $this->cache = array();
		if ($bot->message['usernameraw'] == NAME) return;
		if (substr($bot->message['text'], 0, 8) == '!google ') {
			$data = $this->search(substr($bot->message['text'], 8));
			$bot->queue('Google ['.substr($bot->message['text'], 8).']: http://google.de/search?q='.rawurlencode(substr($bot->message['text'], 8)).' '.Core::language()->get('google_number', array('{number}' => number_format($data['responseData']['cursor']['estimatedResultCount'], 0, Core::language()->decimal_point, Core::language()->thousand_separator))));
			$bot->queue('#1: '.strip_tags($data['responseData']['results'][0]['title']).': '.$data['responseData']['results'][0]['unescapedUrl']);
		}
	}
Ejemplo n.º 4
0
	public function handle(Bot $bot) {
		if ($bot->message['id'] % 500 == 0) $this->config->write();
		if ($bot->message['type'] == Bot::JOIN) {
			
			$userID = $bot->lookUpUserID();
			if (isset($this->config->config[$userID]) && (!isset($this->coolDown[$userID]) || ($this->coolDown[$userID] + 5 * 60) < time())) {
				$bot->queue('['.$bot->message['usernameraw'].'] '.substr($this->config->config[$userID], 0, 250));
				$this->coolDown[$userID] = time();
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 7) == '!quote ') {
			$username = substr(Module::removeWhisper($bot->message['text']), 7);
			$userID = $bot->lookUpUserID($username);
			if ($userID) {
				if (isset($this->config->config[$userID])) {
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" ['.$username.'] '.$this->config->config[$userID]);
				}
				else {
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->quotes_noquote);
				}
			}
			else {
				$bot->queue('/whisper "'.$this->message['usernameraw'].'" '.Core::language()->get('user_not_found', array('{user}' => $username)));
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 10) == '!setquote ') {
			$this->config->config[$bot->lookUpUserID()] = substr(Module::removeWhisper($bot->message['text']), 10);
			$bot->success();
		}
		else if (Module::removeWhisper($bot->message['text']) == '!delquote') {
			unset($this->config->config[$bot->lookUpUserID()]);
			$bot->success();
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 11) == '!wipequote ') {
			if (Core::compareLevel($bot->lookUpUserID(), 'quote.wipe')) {
				$username = substr(Module::removeWhisper($bot->message['text']), 11);
				$userID = $bot->lookUpUserID($username);
				if ($userID > 0) {
					unset($this->config->config[$userID]);
					$bot->success();
				}
				else {
					$bot->queue('/whisper "'.$this->message['usernameraw'].'" '.Core::language()->get('user_not_found', array('{user}' => $username)));
				}
			}
			else {
				$bot->denied();
			}
		}
	}
Ejemplo n.º 5
0
	public function handle(Bot $bot) {
		if (substr($bot->message['text'], 0, 7) != 'apt-get') return;
		$text = explode(' ', substr($bot->message['text'], 8), 2);

		switch ($text[0]) {
			case 'moo':
				$bot->queue('...."Have you mooed today?"...');
			break;
			case 'install':
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				if (stripos($text[1], '--reinstall') !== -1) {
					$text[1] = str_replace('--reinstall', '', $text[1]);
					Core::log()->info = $bot->message['usernameraw'].' reloaded a module';
					$result = Core::reloadModule(trim($text[1]));
				}
				else {
					Core::log()->info = $bot->message['usernameraw'].' loaded a module';
					$result = Core::loadModule(trim($text[1]));
				}
				
				if (!is_int($result)) {
					$bot->success();
				}
				else {
					$name = 'module_error_'.$result;
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->$name);
				}
			break;
			case 'remove':
			case 'purge':
				$text[1] = str_replace('--purge', '', $text[1]);
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				Core::log()->info = $bot->message['usernameraw'].' unloaded a module';
				$result = Core::unloadModule(trim($text[1]));
				if (!is_int($result)) {
					$bot->success();
				}
				else {
					$name = 'module_error_'.$result;
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->$name);
				}
			break;
			case 'upgrade':
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				$modules = Core::getModules();
				foreach ($modules as $module => $tmp) Core::reloadModule($module);
			break;
		}
	}
Ejemplo n.º 6
0
	public function handle(Bot $bot) {
		if (Module::removeWhisper($bot->message['text']) == '!mycolor') {
			preg_match_all('/color: #[0-9a-fA-F]{6}/', $bot->message['username'], $matches);
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" /color '.substr($matches[0][0], 7).' '.substr($matches[0][count($matches[0])-1], 7));
		}
		else if ($bot->message['text'] == '!info') {
			if (Core::compareLevel($bot->lookUpUserID(), 'util.info')) {
				$bot->queue(Core::language()->util_information.':');
				$bot->queue(Core::language()->util_since.": ".date('d.m.Y H:i:s', TIME));
				$bot->queue(Core::language()->util_got.": ".$bot->messageCount.' ('.round($bot->messageCount / (time() - TIME) * 60, 4).'/m)');
				$bot->queue(Core::language()->util_sent.": ".$bot->sendCount.' ('.round($bot->sendCount / (time() - TIME) * 60, 4).'/m)');
			}
			else {
				$bot->denied();
			}
		}
	}
Ejemplo n.º 7
0
	public function handle(Bot $bot) {
		if (Module::removeWhisper($bot->message['text']) == '!shutdown') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.shutdown')) return $bot->denied();
			Core::log()->info = $bot->message['usernameraw'].' shutted the bot down';
			$bot->shutdown();
		}
		else if (Module::removeWhisper($bot->message['text']) == '!restart') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.shutdown')) return $bot->denied();
                        Core::log()->info = $bot->message['usernameraw'].' restarted the bot';
                        $bot->shutdown(SIGUSR1);
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 5) == '!say ') {
			if (!Core::compareLevel($bot->lookUpUserID(), 500)) return $bot->denied();
			$bot->queue(substr(Module::removeWhisper($bot->message['text']), 5));
		}
		else if (Module::removeWhisper($bot->message['text']) == '!loaded') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_loaded.': '.implode(', ', array_keys(Core::getModules())));
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 6) == '!join ') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.join')) return $bot->denied();
			$bot->getConnection()->join(substr(Module::removeWhisper($bot->message['text']), 6));
			$bot->success();
		}
		else if (Module::removeWhisper($bot->message['text']) == '!perms') {
			if (!Core::compareLevel($bot->lookUpUserID(), 500)) return $bot->denied();
			$perms = Core::permission()->getNodes();
			ksort($perms);
			$permString = array();
			foreach ($perms as $name => $level) {
				$permString[] = $name.': '.$level;
			}
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_perms.': '.implode(', ', $permString));
		}
		else if (Module::removeWhisper($bot->message['text']) == '!rooms') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.join')) return $bot->denied();
			$rooms = $bot->getConnection()->getRooms();
			$roomString = array();
			foreach ($rooms as $id => $name) {
				$roomString[] = $name.': '.$id;
			}
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_rooms.': '.implode(', ', $roomString));
		}
	}
Ejemplo n.º 8
0
	public function handle(Bot $bot) {
		if ($bot->message['id'] % 500 == 0) $this->config->write();
		if (substr($bot->message['text'], 0, 1) == '-') {
			if (isset($this->config->config[substr($bot->message['text'], 1)])) {
				$bot->queue($this->config->config[substr($bot->message['text'], 1)]);
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 5) == '!dic ') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.add')) {
				$data = explode(' ', substr(Module::removeWhisper($bot->message['text']), 5), 2);
				if (substr($data[1], 0, 1) == '!') return $bot->denied();
				$this->config->config[$data[0]] = $data[1];
				Core::log()->info = $bot->message['usernameraw'].' added '.$data[0].' to dictionary';
				$bot->success();
			}
			else {
				$bot->denied();
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 8) == '!deldic ') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.add')) {
				$data = substr(Module::removeWhisper($bot->message['text']), 8);
				unset($this->config->config[$data]);
				$bot->success();
			}
			else {
				$bot->denied();
			}
		}
		else if (Module::removeWhisper($bot->message['text']) == '!listdic') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.list')) {
				$entries = array_keys($this->config->config);
				sort($entries);
				$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->dic_listdic.': '.implode(', ', $entries));
			}
			else {
				$bot->denied();
			}
		}
	}
 /**
  * Core::init()
  *
  * Our initialization function. This is called on all page requests to initialize the Core
  * object. Since it's also used during installation (when the databas and/or plugins haven't been
  * installed), the optional parameter controls whether or not the database object and plugins should
  * be initialized.
  *
  * @access public
  * @static
  * @param string $runtimeContext This determines the context in which the Core is being initialized. This
  *          info is used to let plugins instantiate themselves differently, as well as prevent the loading
  *          of incomplete parts of the script.<br />
  *          <b>installation</b>:          a fresh installation, DB not installed yet<br />
  *          <b>installation_db_ready</b>: during installation after the DB has been installed<br />
  *          <b>ui</b>:                    (default) for the main generator page<br />
  *          <b>generation</b>:            when we're in the process of creating actual data
  */
 public static function init($runtimeContext = "ui")
 {
     self::loadSettingsFile();
     error_reporting(self::$errorReporting);
     self::$translations = new Translations();
     self::$language = new Language(self::$defaultLanguageFile);
     self::initSmarty();
     // the order is significant, here
     if ($runtimeContext != "installation" || $runtimeContext != "installation_db_ready") {
         self::initDatabase();
     }
     if ($runtimeContext == "generation") {
         self::initGeoData();
     }
     if ($runtimeContext == "ui" || $runtimeContext == "generation") {
         self::initCountries();
         self::initExportTypes($runtimeContext);
         self::initDataTypes($runtimeContext);
         self::initSessions();
         self::initUser();
     }
 }
Ejemplo n.º 10
0
 /**
  *	Gets a value defined in the Content array.
  *
  *	@param	$key	mixed	Key value.
  *	@param	$class	string	Class name.
  **/
 public static function content($key = false, $error = _error, $class = _class)
 {
     //	make sure Content is loaded
     if (!($class = self::class_get($class, $error))) {
         return false;
     }
     if (!($cont = self::contents($error))) {
         return false;
     }
     if (!($lang = Core::language(false, false, $error))) {
         return false;
     }
     //	return the whole array if no key is specified;
     if (!$key && !is_string($key)) {
         return $cont[$lang][$class];
     }
     if (is_string($key) || is_numeric($key)) {
         return self::_content($key, $class, $cont[$lang]);
     } elseif (is_array($key)) {
         //	the array must have at least two elements and all of them must be string or number'.
         if (count($key) < 2) {
             return self::error(array('array_number', 'content', '2+'), false, $error, $class);
         }
         foreach ($key as $k => $v) {
             if (!is_string($v) && !is_numeric($v)) {
                 $key[$k] = (string) $v;
             }
             //return self::error('invalid_type', false, $error, $class);
         }
         // the first element of the array will always be the source string
         $src = self::_content((string) array_shift($key), $class, $cont[$lang]);
         // do the replacement
         return vsprintf($src, $key);
     }
     // This would only happen if true is sent as key
     return self::error('invalid_argument', false, $error, null);
 }
Ejemplo n.º 11
0
 /**
  * Core::init()
  *
  * Our initialization function. This is called on all page requests to initialize the Core
  * object. Since it's also used during installation (when the database and/or plugins haven't been
  * installed), the optional parameter controls whether or not the database object, plugins, sessions and user
  * should be initialized. Different call contexts require different initialization.
  *
  * @access public
  * @static
  * @param string $runtimeContext This determines the context in which the Core is being initialized. This
  *          info is used to let plugins instantiate themselves differently, as well as prevent the loading
  *          of incomplete parts of the script.<br />
  *          <b>installation</b>:              a fresh installation, DB not installed yet<br />
  *          <b>installationDatabaseReady</b>: during installation after the DB has been installed<br />
  *          <b>ui</b>:                        (default) for the main generator page<br />
  *          <b>generation</b>:                when we're in the process of creating actual data
  *          <b>resetPlugins</b>:              initialized everything except the plugins, which may be safely reset
  */
 public static function init($runtimeContext = "ui")
 {
     self::loadSettingsFile();
     error_reporting(self::$errorReporting);
     // ensure the timezone is set. This is an arbitrary value (well, I live in Vancouver!) but it prevents warnings
     if (ini_get("date.timezone") == "") {
         ini_set("date.timezone", "Canada/Vancouver");
     }
     self::$translations = new Translations();
     // the order is significant in all of this
     if ($runtimeContext != "installation") {
         self::initDatabase();
         if (in_array($runtimeContext, array("installationDatabaseReady", "ui", "generation", "resetPlugins"))) {
             self::initSessions();
         }
         $dbDefaultLanguage = Settings::getSetting("defaultLanguage");
         if (!empty($dbDefaultLanguage)) {
             self::$defaultLanguageFile = $dbDefaultLanguage;
         }
     }
     self::$language = new Language(self::$defaultLanguageFile);
     self::initSmarty();
     if ($runtimeContext == "generation") {
         self::initGeoData();
     }
     if ($runtimeContext == "ui" || $runtimeContext == "generation") {
         self::initCountries();
         self::initExportTypes($runtimeContext);
         self::initDataTypes($runtimeContext);
     }
     if (in_array($runtimeContext, array("ui", "generation", "resetPlugins"))) {
         self::initUser();
     }
     set_time_limit(self::$timeout);
 }
Ejemplo n.º 12
0
 public function getPage($uri)
 {
     $match = '';
     $parts = explode("/", $uri);
     $pages = $this->nav;
     $counter = 0;
     if (in_array($parts[1], $this->languages)) {
         self::$language = $parts[1];
         array_shift($parts);
         array_shift($parts);
         $newuri = '/' . implode('/', $parts);
     } else {
         self::$language = 'en';
         $newuri = $uri;
     }
     if ($uri == '/' && file_exists(self::getRootPath() . 'pages' . DS . self::$language . DS . 'index.md')) {
         $mainpage = array('title' => '', 'url' => "/", 'order' => 0, 'active' => 0, 'file' => DS . 'index.md');
         return $mainpage;
     }
     foreach ($pages as $key => $subpages) {
         if ($newuri == $pages[$key]['url']) {
             $match = $pages[$key];
             $this->nav[$key]['active'] = true;
             return $match;
         }
         if ($match == '' && is_array($subpages)) {
             $i = 0;
             if (array_key_exists('submenu', $subpages) && is_array($subpages['submenu'])) {
                 foreach ($subpages['submenu'] as $key2 => $page) {
                     if ($newuri == $page['url']) {
                         $match = $page;
                         $this->nav[$key]['submenu'][$key2]['active'] = true;
                         $this->nav[$key]['active'] = true;
                         return $match;
                     }
                     $i++;
                 }
             }
         }
     }
     if (file_exists(self::getRootPath() . 'pages' . DS . self::$language . DS . 'index.md')) {
         $notfound = array('title' => '', 'url' => "/404", 'order' => 0, 'active' => 0, 'file' => '/404.md');
         return $notfound;
     } else {
         reset($pages);
         $first_key = key($pages);
         $match = $pages[$first_key];
         return $match;
     }
 }
Ejemplo n.º 13
0
	public function handle(Bot $bot) {
		if ($bot->message['id'] % 500 == 0) $this->config->write();
		if ($bot->message['type'] == Bot::JOIN) {
			$userID = $bot->lookUpUserID();
			if (!isset($this->config->config[$userID])) {
				$this->config->config[$userID] = array('got' => 0, 'has' => 3, 'lastjoin' => 0, 'joins' => 0);
			}
			if ($this->config->config[$userID]['lastjoin'] + 86400 < time()) {
				$this->config->config[$userID]['lastjoin'] = time();
				$this->config->config[$userID]['joins']++;
				if ($this->config->config[$userID]['joins'] >= 3) {
					$this->config->config[$userID]['joins'] = 0;
					$this->config->config[$userID]['has']++;
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" Du kannst jetzt '.$this->config->config[$userID]['has'].' Rosen verteilen: !rose Benutzername');
				}
			}
		}
		if (substr($t = Module::removeWhisper($bot->message['text']), 0, 6) == '!roses') {
			if ($t == '!roses') {
				$userID = $bot->lookUpUserID();
				$username = $bot->message['usernameraw'];
			}
			else {
				$username = substr($t, 7);
				$userID = $bot->lookUpUserID($username);
			}
			if (!isset($this->config->config[$userID])) {
				$this->config->config[$userID] = array('got' => 0, 'has' => 3, 'lastjoin' => 0, 'joins' => 0);
			}
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.$username.' hat bisher '.$this->config->config[$userID]['got']. ' Rosen erhalten und kann noch '.$this->config->config[$userID]['has'].' Stück verteilen.');
		}
		else if (substr($bot->message['text'], 0, 6) == '!rose ') {
			$userID = $bot->lookUpUserID();
			if (!isset($this->config->config[$userID])) {
				$this->config->config[$userID] = array('got' => 0, 'has' => 3, 'lastjoin' => 0, 'joins' => 0);
			}
			if ($this->config->config[$userID]['has'] > 0) {
				$username = substr($bot->message['text'], 6);
				$to = $bot->lookUpUserID($username);
				
				if ($to) {
					if ($to != $userID) {
						if (!isset($this->config->config[$to])) {
							$this->config->config[$to] = array('got' => 0, 'has' => 3, 'lastjoin' => 0, 'joins' => 0);
						}
						$this->config->config[$to]['got']++;
						$this->config->config[$userID]['has']--;
						$bot->queue('['.$bot->message['usernameraw'].'] hat eine Rose an '.$username.' gegeben');
					}
					else {
						$bot->queue('/whisper "'.$bot->message['usernameraw'].'" Du kannst dir nicht selber eine Rose geben');
					}
				}
				else {
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->get('user_not_found', array('{user}' => $username)));
				}
			}
			else {
				$bot->queue('/whisper "'.$bot->message['usernameraw'].'" Du hast keine Rosen');
			}
		}
	}
Ejemplo n.º 14
0
	public function handle(Bot $bot) {
		if ($this->rouletteBullet == 0) $this->rouletteBullet = rand(1,6);
		if (preg_match('~^\.\.\.+$~', $bot->message['text'])) {
			$bot->queue('/me '.Core::language()->toys_pacman);
		}

		if (Module::removeWhisper($bot->message['text']) == '!ping') {
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" !pong');
		}
		else if (substr($bot->message['text'], 0, 5) == '!dice') {
			$command = substr($bot->message['text'], 5);
			$command = explode('d', $command, 2);
			$command[0] = min(10, $command[0]);
			if (count($command) > 1) {
				while ($command[0]--) {
					$results[] = rand(1, $command[1]);
				}
			}
			else {
				 $results[] = rand(1,6);
			}
			sort($results);
			$bot->queue(implode(', ', $results).' wurde von '.$bot->message['usernameraw'].' gewuerfelt');
		}
		else if ($bot->message['text'] == '!kuschel') {
			$bot->queue('/me kuschelt sich an '.$bot->message['usernameraw']);
		}
		else if (substr($bot->message['text'], 0, 2) == '!8') {
			$data = str_split(substr(strtolower($bot->message['text']), 2));
			$sum = 0;
			foreach($data as $char) $sum += ord($char);
			$send = 'toys_eight_'.($sum % self::$eight);
			$bot->queue('['.$bot->message['usernameraw'].'] '.Core::language()->$send);
		}
		else if (substr($bot->message['text'], 0, 5) == '!user') {
			$text = str_split(substr(strtolower($bot->message['text']), 5));
			$sum = 0;
			foreach($text as $char) $sum += ord($char);
			$send = $bot->data['users'][$sum % count($bot->data['users'])]['usernameraw'];
			$bot->queue('['.$bot->message['usernameraw'].'] '.$send);
		}
		else if ($bot->message['type'] == Bot::MODERATE && preg_match('~bis [0-3][0-9].[01][0-9].([0-9]+)~', $bot->message['text'], $matches)) {
			if ($matches[1] > (date('Y') + 9000)) {
				$bot->queue('Its over ninethousand!');
			}
		}
		else if ($bot->message['text'] == '!shot' || $bot->message['text'] == '!spin') {
			if ($bot->message['text'] == '!spin') {
				$this->rouletteBullet = rand(1,6);
				$cost = 4;
				$message = '['.$bot->message['usernameraw'].'] dreht den Zylinder und drückt ab…';
			}
			else {
				$cost = 1;
				$message = '['.$bot->message['usernameraw'].'] drückt ab…';
			}
			if (!isset($this->rouletteStatus[$bot->message['usernameraw']])) $this->rouletteStatus[$bot->message['usernameraw']] = 0;
			$this->rouletteBullet--;
			if ($this->rouletteBullet == 0) {
				$this->rouletteStatus[$bot->message['usernameraw']] += $cost;
				$bot->queue($message.'Boooom');
				$bot->queue('/tmute '.$bot->message['usernameraw'].' '.($this->rouletteStatus[$bot->message['usernameraw']]));
				
				$this->rouletteBullet = rand(1,6);
			}
			else $bot->queue($message.'Klack, nichts passiert');
		}
	}
Ejemplo n.º 15
0
	/**
	 * Prints out a permissionDenied message and logs the command
	 *
	 * @return	void
	 */
	public function denied() {
		$this->queue('/whisper "'.$this->message['usernameraw'].'" '.Core::language()->access_denied);
		Core::log()->permission = $this->message['usernameraw'].' tried to use '.$this->message['text'];
	}