Anyone familiar with POE::componant IRC and/or the IRC protocol in general?


  • I survived the hour long Uno hand

    I'm working in perl, and basically giving myself a crash coursh in IRC by making a bot that ought to run a game in a channel (so, ya know, a toy). For some reason, even when I give the bot op status manually (required for the game to work on the server i'm using, darkmyst.org, because it can't op itself unless the channel and nick are registered and it asks Chanserv nicely), it can't change the topic or give people voice. I suspect programmer error. Ideas?

     

    the revelant lines: 

    sub startgame{ #set up the game
        my $kernel  = $_[KERNEL];
        my $sender = $_[SENDER];
        $kernel->post( $sender => names => $werewolf ); #get a current, updated list of players, as it may have changed since join
        $kernel->post( $sender => privmsg => $werewolf =>"Welcome to the game of Werewolf! For the rules, private message me !rules"); #let them know it's starting
        # $kernel->post( $sender => 'mode' =>  $werewolf => '+o' => $NICK); #op yourself, if possible. Rarely works due to IRC's rules, but the failure might spur someone to remember to op the bot, which is mandatory
        $kernel->post($IRC_ALIAS, 'topic', '$werewolf'," "); #blank the topic of whatever drivel it had
        foreach my $selected (@players) {
        $kernel->post( $IRC_ALIAS => mode => $werewolf => +v => $selected);  #voice everyone
        }

     

    ($werewolf here is the channel name, defaults to #werewolf; $NICK is the bot's nickname, defaults to Wolfbot) 

    It joins, apparently gets the list of names properly because it manages to log the correct list of players later in the code, announces that the game is starting, and then there's no apparent change in anything from the POV of an irc user in the channel. the log indicates that this did, in fact, run:

    Log opened on Tues 04/22/2008 20:18:21 Tues 04/22/2008 20:18:21  : Bot start!
    Tues 04/22/2008 20:18:21  : Connected to irc.darkmyst.org as Wolfbot using port 6667, with username wolfbot 1.5
    Tues 04/22/2008 20:18:21  : joined #werewolf
    Tues 04/22/2008 20:18:21  : received a message from OperServ : WARNING: You may not have any more than 4 clients on the network at once. Any further connections over this limit risks being removed.
    Tues 04/22/2008 20:18:21  : Versioned by WebServ
    Tues 04/22/2008 20:18:21  : Wolfbot Kor Acutis Frankie
    Tues 04/22/2008 20:18:25  : Setup initialized
    Tues 04/22/2008 20:18:25  : 1 wolves for 3 players 

     



  • Quick solution: run tcpdump/ngrep/wireshark or similar network traffic sniffers and log all IRC traffic to the server that you're on. You'll see both the bot and your clients traffic, and can then execute commands (i.e. voiceing, authenticating w/ chanserv, etc) on both clients and observe the actual data transmitted. Once your bot formats the commands exactly like your client, you're good to go.


Log in to reply