collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: website module for bebot with the large colors module  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
website module for bebot with the large colors module
« on: February 28, 2007, 05:55:25 pm »
We have in our old bot the ability to call up the org website at will, and I couldn't find such a thing here, so my friend Evereane and I made one.

It requires the larger colors.php file available here, (the one with all the predefined colors), and it doesn't check your string formatting, all it does is store whatever string you feed it into the 'settings' table, and retrieve it on demand, includes a popup with a link for in-game launching.

WebSite_GUILD.php:
Code: [Select]
<?
/*
Website module for BeBot 0.2.x
Requires expanded colors module

Created by Evereane and Parfet (RK2)
*/
$website = new Website($bot);

$commands["tell"]["website"] = &$website;
$commands["pgmsg"]["website"] = &$website;
$commands["gc"]["website"] = &$website;


  /*
    The Class itself...
  */
  class Website
  {
    var $bot;
   

    /*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    function Website (&$bot)
    {
      $this -> bot = &$bot;
    }



    /*
      This gets called on a tell with the command
    */
    function tell($name, $msg)
    {
        if (preg_match("/^" . $this -> bot -> commpre . "website set (.+)$/i", $msg, $info)) {
$output = $info[1];
$this -> set_website($name, $output);
}
        else
            $this -> bot -> send_tell($name, $this -> get_website($output));
}


    /*
      This gets called on a msg in the privgroup with the command
    */
    function pgmsg($name, $msg)
    {
        if (preg_match("/^" . $this -> bot -> commpre . "website set (.+)$/i", $msg, $info)) {
$output = $info[1];
            $this -> set_website($name, $output);
}
else
            $this -> bot -> send_pgroup($this -> get_website($output));
    }
   
   
   
    /*
      This gets called on a msg in the guildchat with the command
    */
    function gc($name, $msg)
    {
        if (preg_match("/^" . $this -> bot -> commpre . "website set (.+)$/i", $msg, $info)) {
$output = $info[1];
$this -> set_website($name, $output);
}
        else
        $this -> bot -> send_gc($this -> get_website($output));
    }


    /*
        Grabs the website and formats the message
    */
    function get_website($msg)
    {
        $result = $this -> bot -> db -> select("SELECT value FROM settings WHERE setting='website'");
        if (!empty($result[0][0])){
$inside = "<a href='chatcmd:///start " . $result[0][0] . "/'>" . $result[0][0] . "</a>";
        return "Guild Website :: " . $this -> bot -> colors -> colorize('highlight', $result[0][0]) . " :: " . $this -> bot -> make_blob("Click to View", $inside);
        } else {
            return $this -> bot -> colors -> colorize("error", "Guild Website Not Set :: /tell <botname> <pre>website set http://..");
}
    }


    /*
        Sets the website
    */
    function set_website($name, $msg)
    {
if ($this -> bot -> admin -> in_group($name, "admin")) {
            $this -> bot -> db -> query("REPLACE INTO `settings` (`setting`, `value`) VALUES ('website', '" . $msg . "');");
$result = $this -> bot -> db -> select("SELECT value FROM settings WHERE setting='website'");
if (!empty($result[0][0]) and $result[0][0]=$msg){
$this -> bot -> send_tell($name, $this -> bot -> colors -> colorize("green", "Website successfully set as " . $msg));
} else {
$this -> bot -> send_tell($name, $this -> bot -> colors -> colorize("error", "Error updating website, please try again"));
}
}
else {
$this -> bot -> send_tell($name, $this -> bot -> colors -> colorize("error", "You are not authorized to use this command"));
}
}
}
?>

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 660
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal