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.

bind notc private

Help for those learning Tcl or writing their own scripts.
Post Reply
o
opsb
Halfop
Posts: 41
Joined: Sat Sep 01, 2007 1:41 pm

bind notc private

Post by opsb »

how to edit

bind notc -|- *text* proc

just for private notice.. not for channel notices
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

TCL Doc's
NOTC (stackable)

bind notc <flags> <mask> <proc>
procname <nick> <user@host> <handle> <text> <dest>

Description: dest will be a nickname (the bot's nickname, obviously) or a channel name.
mask is matched against the entire notice and can contain wildcards.
It is considered a breach of protocol to respond to a /notice on IRC, so this is intended for internal use (logging, etc.) only.
Note that server notices do not trigger the NOTC bind. If the proc returns 1, Eggdrop will not log the message that triggered this bind.

New Tcl procs should be declared as

proc notcproc {nick uhost hand text {dest ""}} {
global botnick; if {$dest == ""} {set dest $botnick}
...
}

for compatibility.

Module: server
Example:

Code: Select all

bind notc - "*hello my bot*" notc:bot:hello

proc notc:bot:hello {nick host handle text {dest ""}} {
global botnick
 if {$dest == ""} {set dest "${botnick}"}
  if {[validuser $handle]} {
   puthelp "NOTICE $nick :Hello my user! :)"
    return
  } else {
   puthelp "NOTICE $nick :I am not a bot! :("
    return
 }
}
When someone dose something like the following (note that the text used in the bind will match all of the following as well);
/notice Bot errm hello my bot?
/notice Bot hello my bot!
/notice Bot hello my bot
The bot will respond with "Hello my user! :)" if the bot has them in there userfile. Or The bot will respond with "I am not a bot! :(" if there not. As long as the "return 1" isn't used, the bot will still log the notice to the log file. The text can be anything, like a nickserv string and can contain wildcards, Match Characters.
Match characters
Many of the bindings allow match characters in the arguments. Here are the four special characters:
? matches any single character
* matches 0 or more characters of any type
% matches 0 or more non-space characters (can be used to match a single word)
~ matches 1 or more space characters (can be used for whitespace between words)
hope it helps :)

EDIT: fixed error, Thx nml :)
Last edited by TCL_no_TK on Thu Jan 31, 2008 8:10 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@opsb:
Write your proc in a fashion like this:

Code: Select all

bind notc -|- *text* yourproc
proc yourproc {nick host hand text {dest ""}} {
 if {$dest != "" || ![isbotnick $dest]} {
  return 0
 }

# Rest of the code here, only evaluated if notice was sent to bot, and not a channel.

}
@TCL_no_TK:
Err, think you mixed up the recognized user with the non-recognized ones...
Also, I believe the original question was wether the notice was sent to the bot or not, not wether the bot knows the sender or not...
NML_375
o
opsb
Halfop
Posts: 41
Joined: Sat Sep 01, 2007 1:41 pm

Post by opsb »

Post Reply