This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

how to make a bot respond to !<something>

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
M
Melkimo
Voice
Posts: 2
Joined: Wed Jan 19, 2011 11:48 am

how to make a bot respond to !<something>

Post by Melkimo »

@Melkimo> !beer nadine
* +SecsyDiva gives a beer to nadine


atm it says: * +SecsyDiva gives a beer to Melkimo

I am looking for how to make the bot respond to !(something) <nick refered too) message
But at this point I got to where it responds to the nick saying the !something (and ignores the $nick it should respond too)

Code: Select all

proc pub_water {nick uhost hand channel arg} {
 global botnick
 putserv "PRIVMSG $channel :\001ACTION gives $nick a bottle of water\001"
 return 0
 }
bind pub - !water pub_water
What should I change or add to make this work :)
It should be easy, but uhmm yea, I am looking over it.
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

Code: Select all

bind pub - !water pub_water

proc pub_water {nick uhost hand channel arg} { 
set who [lindex $arg 0]
if {$who == ""} {set who $nick}
putserv "PRIVMSG $channel :\001ACTION gives $who a bottle of water\001" 
}

[05:58pm] <doggo> !water
[05:58pm] * [spunky] gives doggo a bottle of water
[05:58pm] <doggo> !water [spunky]
[05:58pm] * [spunky] gives [spunky] a bottle of water
[06:00pm] <doggo> !water nadine
[06:00pm] * [spunky] gives nadine a bottle of water

Code: Select all

set who [lindex $arg 0]

sets the VAR who to the nick you want to give water to

Code: Select all

if {$who == ""} {set who $nick}

if who is empty then your nick or whoever triggered the cmd will be used

hope this helped
M
Melkimo
Voice
Posts: 2
Joined: Wed Jan 19, 2011 11:48 am

Post by Melkimo »

Yea that works ! Thanks

Is it possible to make the same !command in private with the bot but sending the output to a specified channel?

Like

/msg <bot> !beer Nadine #channel
And it responds in
#channel <botnick> /me gives Nadine a beer
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Code: Select all

proc pub_water {nick uhost hand channel arg} { 
should be

Code: Select all

proc pub_water {nick uhost hand channel text} { 
arg is special. and remenber to use

Code: Select all

[lindex [split $text] 0]
:)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Actually, arg is fine. It's the word "A R G S" or args, which has special meaning. Just to clarify that part. ;)
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

lol was close enough arg today, args tomorrow maybe :P
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

What about adding more , for example !shoot it will be "bot shoots $who"
!kill ..etc.
Post Reply