L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 12:45:14 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: website module for bebot with the large colors module
Pages: [1]   Go Down
« previous next »
Print
Author Topic: website module for bebot with the large colors module  (Read 286 times)
0 Members and 1 Guest are viewing this topic.
Parfet
Rookie
**
Offline Offline

Posts: 33


website module for bebot with the large colors module
« on: February 28, 2007, 11:55:25 AM »

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:
<?
/*
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"));
}
}
}
?>
Logged
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: website module for bebot with the large colors module
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[November 21, 2008, 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 18
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 19
Total: 20
xlDanek

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.296 seconds with 29 queries. (Pretty URLs adds 0.029s, 4q)
Loading...