Logo classes.scriptsphp.org PHP

go to nav bar

Bot IRC - Documentation plugins

Plugin plug_help

Affiche l'aide des plugins chargés


Description

Ce plugin permet l'affichage de l'aide de tous les plugins chargés.


Utilisation.

Commandes utilisateurs :

  • !help :: Affiche l'aide des pluggins chargés.
go to the top

Source du plugin.

<?php
/**
 * fichier : plug_help.php : 
 * plugin d'affichage de l'aide
 *
 * @package Cspbot
 * @since 2006/12/17
 * @version 0.2
 * @author Fabrice Lezoray - Tetsuo - Alain Nicolas (mcAllan)
 * @copyright See licence.txt
 * 
 */

class plug_help extends plugin {
    
    
/**
     * IRCMain object
     * @var object IRCMain
     */
    
private $main;    
    
    
/**
     * Constructor
     *
     * @param IRCMain main
     * 
     */
    
public function __construct($main) {
        
$this->main $main;
    }
    
    
/**
     * Start run plugin
     * 
     */
    
public function start() {
        
$this->sendHelp();
    }

    
/**
     * Send help
     * 
     */
    
private function sendHelp() {
        
$linee "\002\0034--------------------------------------\003\002";
        
$titre "\002\0034------\002\00311 HELP FOR XBOT COMMANDS \003\002\0034--------\003\002";
        
$copyrt "\002\0032---\002\00311 http://classes.scriptsphp.net/ \003\002\0034---\003\002";
        
$auths "\002\0032------ by Fab, Tetsuo & mcAllan ------\003\002";
        
        if(
preg_match('`^\!help(.*)`i'$this->main->mess)) {
            
            
$this->main->sendPrivMsg($this->main->from $linee);
            
$this->main->sendPrivMsg($this->main->from $titre);            $this->main->sendPrivMsg($this->main->from $linee);    
            
$this->sendPluginHelp($this->main->from);
            
$this->main->sendPrivMsg($this->main->from $copyrt);
            
$this->main->sendPrivMsg($this->main->from $auths);
        }
    }
    
    private function 
sendPluginHelp($to) {

        
$linee "\002\0034--------------------------------------\003\002";
        foreach (
$this->main->plugs->activePlugs as $name => $plug ) {
            if(!empty(
$plug->help['op'])){
                
$this->main->sendPrivMsg$this->main->from "\002Plugin : ".$name." *** Commandes opérateurs : \002" );
                
$txt explode "\n"trim($plug->help['op']));
                foreach ( 
$txt as $line ) {
                    if(
trim($line) !== '') {
                        
$this->main->sendPrivMsg$this->main->from $line );                
                    }
                }
            }
            if(!empty(
$plug->help['all'])){
                
$this->main->sendPrivMsg$this->main->from "\002Plugin : ".$name." *** Commandes utilisateurs : \002" );
                
$txt explode "\n"trim($plug->help['all']));
                foreach ( 
$txt as $line ) {
                    if(
trim($line) !== '') {
                        
$this->main->sendPrivMsg$this->main->from $line );                
                    }
                }
            }
            
$this->main->sendPrivMsg($this->main->from $linee );
        }
    }

}

?>
go to the top

Merci de ne pas suivre ce lien emails.

0.0850s | «»
PHP powered