egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to do string match for IRC Action?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
JaySon
Voice


Joined: 04 Aug 2014
Posts: 6

PostPosted: Fri Aug 08, 2014 5:23 pm    Post subject: How to do string match for IRC Action? Reply with quote

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
View user's profile Send private message
heartbroken
Op


Joined: 23 Jun 2011
Posts: 106
Location: somewhere out there

PostPosted: Fri Aug 08, 2014 9:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
JaySon
Voice


Joined: 04 Aug 2014
Posts: 6

PostPosted: Fri Aug 08, 2014 9:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
heartbroken
Op


Joined: 23 Jun 2011
Posts: 106
Location: somewhere out there

PostPosted: Fri Aug 08, 2014 10:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
shipmark33
Voice


Joined: 01 Oct 2014
Posts: 1

PostPosted: Wed Oct 01, 2014 3:54 pm    Post subject: Mohsin Reply with quote

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
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Thu Oct 02, 2014 2:01 pm    Post subject: Reply with quote

Try restart the bot and se what happens
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber