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: Cron module  (Read 9781 times)

0 Members and 2 Guests are viewing this topic.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #15 on: February 14, 2009, 11:25:52 pm »
Oh right, I forgot - command links only work inside blobs.

So pack the chat command line inside a blob (make_blob() in the tools module will do that quite nicely) and it should work.

Of course, you could simply direcly execute the command by calling $this->command_handler("", "scripts events", "gc") if the cron job is running in the scripts module. That way you'll have the same effect as someone clicking on the link.

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #16 on: February 15, 2009, 12:25:55 am »
Oh the last thing seems quiet what I´m looking for....you now..some Guildmates ar LAAZYYY...

Can I just replace the send_gc with your string???

(remember I´m beginner - and not English native speaker :p )

Thanks so much for your suppport here.

EDIT:

Code: [Select]
[cron] Broken Plugin, received unhandeled command

what do you mean with "if the cron job is running in the scripts module"?
Do I have to rewrite sth in the command_handler? I´m gettig crazy with that task :p

so now i try
Code: [Select]
function cron($interval)
   {
   $inside="##blob_title##Events der Woche##end##\n\n";
   $inside.= implode("", file("./txt/events.txt"));
   return "Events der Woche: " . $this -> bot -> core("tools") -> make_blob("zum Ansehen hier klicken", $inside);
//$this->command_handler("", "gevent", "gc");
   }

..that does...nothing...

I probably forgot sth..no clue.

« Last Edit: February 15, 2009, 01:23:15 am by xdave78 »

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #17 on: February 16, 2009, 02:22:11 pm »
no one any idea??? :(

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #18 on: February 16, 2009, 05:43:07 pm »
You should put the cron() function inside the scripts module. Otherwise you can't reach the scripts command handler in an easy way.

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #19 on: February 16, 2009, 06:58:40 pm »
OMG...I dont know if I could get tis done as such a noob.

@Alreadythere:
Can I leave the con Module as it is and just take out the function()?
Code: [Select]
function cron($interval)
   {
$this -> bot -> send_gc("Events der Woche - <a href='chatcmd:///tell <botname> <pre>script events'>Klick!</a>");
   }
(Leave the registration and the build of the cron in cron.php)
And then put the function() into the scripts.php to call cron?!

Like sth... (this is the mak function of the scripts.php)
Code: [Select]
    function make_script($script)
    {
        if(false !== ($handle = @fopen("scripts/".$script.".txt", "r")))
        {
            $content = fread($handle, filesize("scripts/".$script.".txt"));
            fclose($handle);

            $content = "<font color=CCInfoHeadline> :::: Script Name [".$script."] ::::</font>\n\n".$content;
            return "Script :: " . $this -> bot -> core("tools") -> make_blob("click to view", $content);
        }

        return "Specified script not found! - " . $this -> make_list();
    }
}

and then put in at the End
Code: [Select]
function cron($interval) 
 {
$this -> bot -> send_gc($content);
   }


..or do I have to mesh up the whole cron.php content wirth the scripts.php????

Sorry there a massive errors in it for sure...but my last c++ program is 13years ago...


@all:
Perhaps so could do it for me ...I´d even pay for a module whith which I could call a script (txt) by using cron. The thing is, that it would be best that way because the "Events.txt" (script content) changes every week. PN me if interested. No clue how many work that is, for so used to coding perhaps 30Mins or an Hour?!
« Last Edit: February 16, 2009, 07:11:05 pm by xdave78 »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #20 on: February 16, 2009, 07:23:20 pm »
You need to register cron in the constructor of the scripts module (replace 30min with whatever time you want):
Code: [Select]
$this->register_event("cron","30min");
Then try the following cron function in the script module:
Code: [Select]
function cron($delay)
{
$this->bot->send_gc($this->make_script("events"));
}

And simply remove the cron module completely unless you want it to spam something else.

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #21 on: February 16, 2009, 08:33:05 pm »
YESSSS.....

I got it!!!!

Thank you so much Alreadythere.

 

* 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: 683
  • 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