BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Module Requests => Topic started by: Sinaii on September 02, 2009, 02:15:48 am

Title: Spam Announcement/script
Post by: Sinaii on September 02, 2009, 02:15:48 am
Hello.

Any body know how it would be possible to spam in guildchat some annoucement every 1hours ?


and how can i use the .html script used in aoc script folder to be called like !kos or !guide but from the bot directly ?

I tryed the !guide modeul but it don't work like i would, i just want the html script to be called or the .txt file

Title: Re: Spam Announcement/script
Post by: Jiheld on September 02, 2009, 11:02:37 am
hi, i use the cron script for that.

Code: [Select]
<?php
/*
* cron.php - Spam guildchat by Jiheld.
* Cron module - <module description>
* <Copyright notice for your module>
*
* BeBot - An Anarchy Online & Age of Conan Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005-2007 Thomas Juberg StensÃ¥s, ShadowRealm Creations and the BeBot development team.
*
* Developed by:
* - Alreadythere (RK2)
* - Blondengy (RK1)
* - Blueeagl3 (RK1)
* - Glarawyn (RK1)
* - Khalem (RK1)
* - Naturalistic (RK1)
* - Temar (RK1)
*
* See Credits file for all aknowledgements.
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; version 2 of the License only.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
*  USA
*

*/

/*
Add a "_" at the beginning of the file (_ClassName.php) if you do not want it to be loaded.
*/

$thisClass = new cron($bot);

/*
The Class itself...
*/
class cron extends BaseActiveModule
{

function __construct (&$bot)
{
//Initialize the base module
parent::__construct(&$botget_class($this));




$this->register_event('cron''20min'); // time when the script needs to spam the GC.


}


/*
Unified message handler
$source: The originating player
$msg: The actual message, including command prefix and all
$type: The channel the message arrived from. This can be either "tell", "pgmsg" or "gc"
*/
function command_handler($source$msg$origin)
{
//ALWAYS reset the error handler before parsing the commands to prevent stale errors from giving false reports
$this->error->reset();

//The default is to split the command to com, sub and args. If you want to split it some other way change the pattern for it
//parse_com() returns an array where the pattern is the keys and the values are split out from $msg
$com $this->parse_com($msg, array('com''sub''args'));

$command $vars[0];

switch($com['com'])
{
case 'command1':
return($this -> somefunction($name$com));
break;
case 'command2':
return($this -> someotherfunction($name$com));
default:
// Just a safety net to allow you to catch errors where a module has registered  a command, but fails to actually do anything about it
$this -> error -> set("Broken plugin, recieved unhandled command: $command");
return($this->error->message());
}
}

/*
This gets called on cron  if you previously registered the event 'cron, interval'
$interval is the string name for the time delay between two cron jobs.
*/
function cron($interval)
{
$this -> bot -> send_gcpost what ever you want here to get in the GC.##end##");
}



}
?>

Title: Re: Spam Announcement/script
Post by: Sinaii on September 02, 2009, 12:51:08 pm
Thx i will try the script

line 102 $this -> bot -> send_gc( post what ever you want here to get in the GC.##end##");

should be

$this -> bot -> send_gc("post what ever you want here to get in the GC.##end##");
SimplePortal 2.3.7 © 2008-2024, SimplePortal