Reading commands from actions e.g /me smiles at BOT

Back to Module Development

Page: 1  
From User Message Body
Addramyr
Post #20
user avatar
Member
Date: 3:51 am, Feb 6 2006
Posts: 43


how would i go about making a script that replys to actions. i can get it to work in any other format but actions... does anyone have any ideas?

___________
Addramyr
CEO Skieweb Technologies
http://wwww.skieweb.com
Manick
Post #21
user avatar
Admin
Date: 6:31 am, Feb 6 2006
Posts: 223


Welcome to the forums.

Yea, you bring up a good point. I may just add this feature to version 2.2.1 before releasing it.

For now, you can capture using the 'privmsg' type, and then, if it is an action, then the message will be formatted as so:

chr(1) . "ACTION " . $msg . chr(1)

So, you can parse for the chr(1) . "ACTION ", and if you see that, then you know that it's an action. parse out the chr(1)'s and that ACTION and you should be good to go.

Thanks for the suggestion!

--Manick
PHP-IRC Developer
nefus
Post #28
user avatar
Admin
Date: 3:30 am, Feb 7 2006
Posts: 17


Whats your ultimate goal Addramyr? Got something cool in mind?

Addramyr
Post #29
user avatar
Member
Date: 4:00 am, Feb 7 2006
Posts: 43


Iím developing a plug-in that allows users to administer their channels, something like chanserv but with allot more features.

Although I cant find a way so the bot knows the user is logged in? Cookies/Sessions wont work in IRC obviously. But does PHP-IRC detect if a users nick is registered? If so I can check if the user is Registered and continue from there :)

-Addramyr

___________
Addramyr
CEO Skieweb Technologies
http://wwww.skieweb.com
Manick
Post #30
user avatar
Admin
Date: 2:29 pm, Feb 7 2006
Posts: 223


Well, it doesn't initially. Checking to see if someone is registered requires a whois or status command if I'm not mistaken. It wouldn't be very efficient if php-irc just whoised everyone all the time would it be? Users can technically change their registered status or log in/out at any time...

--Manick
PHP-IRC Developer
Addramyr
Post #31
user avatar
Member
Date: 4:41 pm, Feb 7 2006
Posts: 43


Well i set it so that as long as they are in the channel that they have access in and have atleast ops, it counts them as logged in :)

___________
Addramyr
CEO Skieweb Technologies
http://wwww.skieweb.com
Manick
Post #32
user avatar
Admin
Date: 5:40 pm, Feb 7 2006
Posts: 223


Yea, often just checking if they're op in the channel is usually enough. Untrusted ops is the channel management's fault.

--Manick
PHP-IRC Developer
Addramyr
Post #33
user avatar
Member
Date: 8:02 pm, Feb 7 2006
Posts: 43


When a user joins a channel what values does the bot pass? e.g in the seen_mod.conf it has 'join seen_mod seen' what variables does it send to the function seen ?

from what ive seen $line, $args are empty :(

PS
Manick do you have MSN?

___________
Addramyr
CEO Skieweb Technologies
http://wwww.skieweb.com
Manick
Post #34
user avatar
Admin
Date: 8:05 pm, Feb 7 2006
Posts: 223


They shouldn't be empty... the syntax is explained for $line and $args in the readme.txt. Here's an excerpt:

We need to parse this into meaningful parts in order to do anything with the bot. The $line array does that:
from => full nick/ident/host, in this case: "Manick!~bugs@Rizon-2EFC6E17.resnet.purdue.edu"
fromNick => only nick, in this case, "Manick"
fromHost => only host, in this case, "Rizon-2EFC6E17.resnet.purdue.edu"
fromIdent => The Ident of the user, in this case, "~bugs"
cmd => irc command used, (i.e., PRIVMSG, NOTICE, 366, 353, etc), in this case "PRIVMSG"
to => who this command was directed at (channel or your nick), in this case, "#manekain"
text => everything after : in the line; basically the text of what someone says, in this case, "!ad"
params => useful when parsing 'mode' commands etc. in this case, ":!ad"
raw => the full untouched line.

$args
-----
This is a simple array created from the $line['text'] variable. It contains the following data:

nargs => the number of arguments
cmd => the command used
arg1 => present if there are 1 arguments or more
arg2 => present if there are 2 arguments or more
arg3 => present if there are 3 arguments or more
arg4 => present if there are 4 arguments or more
query => The full text (all of args put together)
(there are no more after arg4..)

[edit] About MSN, Yes I do, but that's for family only. I really don't like to be hounded with tons of questions about php-irc all the time, if you know what I mean ;)

[edit2] btw, you can use print_r($line) or print_r($args) to see what is in these.

--Manick
PHP-IRC Developer
Addramyr
Post #35
user avatar
Member
Date: 8:11 pm, Feb 7 2006
Posts: 43


No Problem :)

Last edited by Addramyr at 8:32 pm, Feb 7 2006

___________
Addramyr
CEO Skieweb Technologies
http://wwww.skieweb.com
   

  Pages (3) [ 1 2 3 ] Next Page

Back to Module Development