| View previous topic :: View next topic |
| Author |
Message |
JaySon Voice
Joined: 04 Aug 2014 Posts: 6
|
Posted: Fri Aug 08, 2014 5:23 pm Post subject: How to do string match for IRC Action? |
|
|
I want to do something like:
| Code: |
bind pubm - * reply:action
proc reply:action {nick host hand chan txt} {
set txt [string tolower $txt]
if {([string match -nocase "goes to sleep" $txt] || [string match -nocase "wants to sleep" $txt]) && ![isbotnick $nick]} {
puthelp "PRIVMSG $chan :$nick, don't fall asleep"
}
return 0
}
|
But, I want this command to be performed only when a user says: /me goes to sleep or /me wants to sleep (\001ACTION \001), and not a PRIVMSG. How can I change the string match so it works only with ACTION, and not PRIVMSG? |
|
| Back to top |
|
 |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
Posted: Fri Aug 08, 2014 9:10 pm Post subject: |
|
|
| Code: | bind ctcp - ACTION reply:action
proc reply:action {nick uhost hand dest key text} {
if {[string match -nocase "*goes*sleep*" $text] || \
[string match -nocase "*want*sleep*" $text] && $dest ne $::botnick} {
puthelp "PRIVMSG $dest :$nick, don't fall asleep"
}
} |
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html#binda _________________ Life iS Just a dReaM oN tHE wAy to DeaTh
Last edited by heartbroken on Fri Aug 08, 2014 9:14 pm; edited 1 time in total |
|
| Back to top |
|
 |
JaySon Voice
Joined: 04 Aug 2014 Posts: 6
|
Posted: Fri Aug 08, 2014 9:11 pm Post subject: |
|
|
Thank you
I'm having another issues:
| Code: |
bind ctcp - ACTION reply:action
proc reply:action {nick uhost hand dest key text} {
if {[string match -nocase "*goes*sleep*" $text] || \
[string match -nocase "*want*sleep*" $text] && $dest eq "JaySon"} {
puthelp "PRIVMSG $dest :$nick, don't fall asleep"
}
}
|
I want it to make it only respond to one user, but even when other users besides "JaySon" say "*goes*sleep*" or "*want*sleep*", the bot still responds this message in the channel. |
|
| Back to top |
|
 |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
Posted: Fri Aug 08, 2014 10:45 pm Post subject: |
|
|
| Code: | bind ctcp - ACTION reply:action
proc reply:action {nick uhost hand dest key text} {
if {![string match -nocase "*goes*sleep*" $text] || \
![string match -nocase "*want*sleep*" $text] && $dest eq $::botnick} { return }
if {[string equal -nocase "JaySon" $nick]} {
puthelp "PRIVMSG $dest :$nick, don't fall asleep"
}
} |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
| Back to top |
|
 |
shipmark33 Voice
Joined: 01 Oct 2014 Posts: 1
|
Posted: Wed Oct 01, 2014 3:54 pm Post subject: Mohsin |
|
|
I want it to make it only respond to one user, but even when other users besides "JaySon" say "*goes*sleep*" or "*want*sleep*", the bot still responds this message in the channel. _________________ You can get score highest marks in brain dumps dumps exam using ICMA and New York University . |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Thu Oct 02, 2014 2:01 pm Post subject: |
|
|
Try restart the bot and se what happens _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
|