当前位置: 首页>>代码示例>>PHP>>正文


PHP Func::stripFormat方法代码示例

本文整理汇总了PHP中Func::stripFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::stripFormat方法的具体用法?PHP Func::stripFormat怎么用?PHP Func::stripFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Func的用法示例。


在下文中一共展示了Func::stripFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * What's a parser without a parse method? Exactly, nothing much. So...
  * here it is. This method will happily parse our LVP echo channel
  * message and extract the needed informations. These will then be put 
  * to use in other methods.
  * 
  * @var Bot $pBot The bot which received the message.
  * @var string $sMessage The actual message we're going to parse.
  */
 public function parse(Bot $pBot, $sMessage)
 {
     $aChunks = preg_split('/\\s+/', $sMessage);
     switch ($aChunks[0]) {
         case '05***':
             $this->handleAdminMessage($pBot, substr($sMessage, 7), $aChunks);
             break;
         case '2***':
             if ($aChunks[1] == '7Admin' || $aChunks[1] == '7Report') {
                 $this->handleCrewChat($pBot, $aChunks[2], implode(' ', array_slice($aChunks, 4)), $aChunks);
             }
             break;
         case '4***':
             if ($aChunks[1] == 'Global' && $aChunks[2] == 'Gamemode' && $aChunks[3] == 'Initialization') {
                 $this->handleGamemodeInit();
             }
             break;
         case '4IP':
             $nId = substr($aChunks[3], 4, -2);
             $this->handleIpMessage($pBot, $nId, $aChunks[2], $aChunks[4], $aChunks);
             break;
     }
     if (!isset($aChunks[1])) {
         return;
     }
     switch ($aChunks[1]) {
         case '03***':
         case '3***':
             $nId = substr(Func::stripFormat($aChunks[0]), 1, -1);
             if ($aChunks[3] == 'joined') {
                 $this->handleJoinGame($pBot, $nId, $aChunks[2], $aChunks);
             } else {
                 if ($aChunks[3] == 'left') {
                     $this->handleLeaveGame($pBot, $nId, $aChunks[2], substr($aChunks[6], 1, -3), $aChunks);
                 } else {
                     if ($aChunks[4] == 'logged') {
                         $this->handleLoggedIn($pBot, $nId, $aChunks[2], $aChunks);
                     }
                 }
             }
             break;
         default:
             if (substr($aChunks[1], 0, 3) == '07' && substr($aChunks[1], -2) == ':') {
                 $nId = substr(Util::stripFormat($aChunks[0]), 1, -1);
                 $sNickname = substr(Util::stripFormat($aChunks[1]), 0, -1);
                 $this->handleMainChatMessage($pBot, $nId, $sNickname, implode(' ', array_slice($aChunks, 2)), $aChunks);
             }
             break;
     }
     /* Enable this when going to save the echo logs.
        if (in_array ($aChunks [0], $this -> m_aIgnoreTriggers))
        {
                return ;
        }
        
        if (count ($aChunks) == count (explode (', ', implode (' ', $aChunks))))
        {
                // Filter out the !players command.
                return ;
        }
        
        if (Func :: getPieces ($aChunks, ' ', 0, 3) == 'has been online for' ||
            Func :: getPieces ($aChunks, ' ', 0, 2) == 'is a player' ||
            Func :: getPieces ($aChunks, ' ', 0, 4) == 'requested player is not registered')
        {
                return ;
        }
        */
 }
开发者ID:LVPlayground,项目名称:bot-saber,代码行数:78,代码来源:LVPEchoMessageParser.php


注:本文中的Func::stripFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。