simple reply module wont work

Back to Module Development

Page: 1  
From User Message Body
eagle
Post #979
Member
Date: 7:20 pm, Jun 5 2009
Posts: 7


I've been messing with existing modules with reasonable success but now I'd like to build one from scratch. I'm very experienced in procedural PHP and a little OO but somehow I can't get the simplest function to work.

test2.conf *updated*
Code
file test2 modules/test2/test2.php

priv foo1 test2 foobar1

priv foo2 true true true 0 test2 foobar2


test2.php
Code
<?php
class test2 extends module {
    
    public $title = "test2";
    public $author = "eagle";
    public $version = "0.1.1";
    
    // respond to foo1 in the channel
    public function foobar1($line, $args){
        
        $who = "#chat";
        $msg = "bar1";
        $this->ircClass->privMsg($who, $msg, $queue = 1);
        return;
        
    }
    
    // respond to foo2 in the private msg
    public function foobar2($line, $args){
        
        $who = $line['fromNick'];
        $msg = "bar2";
        $this->ircClass->privMsg($who, $msg, $queue = 1);
        return;
        
    }
}

?>


What am I doing wrong?

Last edited by eagle at 11:19 am, Jul 6 2009

ElementalAlchemist
Post #982
Member
Date: 12:54 am, Jul 2 2009
Posts: 4


I haven't a clue how old this is but I'm posting anyway.

In your conf file, you need priv foo1, not just foo1.

eagle
Post #983
Member
Date: 11:16 am, Jul 6 2009
Posts: 7


It's about a month old but still relevant, I've paused working on the bot since. ;)

I've added the priv but it's still not doing anything. Any other ideas?

eagle
Post #984
Member
Date: 2:15 am, Jul 7 2009
Posts: 7


With great joy and a little shame I'll post the solution to my problem, just in case in the next 100 year someone just as blind as me shows up.

function.conf (old - bad)
Code

;include modules/test2/test2.conf


function.conf (new - good)
Code

include modules/test2/test2.conf


*sighcakes*

Mad_Clog
Post #985
user avatar
Member
Date: 5:27 pm, Jul 7 2009
Posts: 176


That would help ;)
A simple way to check if a module is loaded is to do a CTCP version on the bot.
The reply will show all installed modules.

   

Back to Module Development