Difference between revisions of "Binds"
(→Messages - Notices) |
|||
Line 31: | Line 31: | ||
}</source>|server}} | }</source>|server}} | ||
+ | ==Canal== | ||
+ | {{Bind|PUB|bind pub <flags> <command> <proc>|procname <nick> <user@host> <handle> <channel> <text>|Utilisé pour une commande donnée sur un canal. Le premier mot devient la commande, ceux qui suivent deviennent les arguments ''text''.|irc}} | ||
+ | |||
+ | {{new}} Si la procédure renvoit 1, Eggdrop n'enregistrera pas le message qui a déclenché le bind. PUBM est traité avant PUB. Si exclusive-bind est activé, les PUB ne seront pas déclenchés par un texte qui aura fait réagir PUBM.|irc}} | ||
{{Translation}} | {{Translation}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
{{Bind|JOIN|bind join <flags> <mask> <proc>|procname <nick> <user@host> <handle> <channel>|triggered by someone joining the channel. The mask in the bind is matched against "#channel nick!user@host" and can contain wildcards.|irc}} | {{Bind|JOIN|bind join <flags> <mask> <proc>|procname <nick> <user@host> <handle> <channel>|triggered by someone joining the channel. The mask in the bind is matched against "#channel nick!user@host" and can contain wildcards.|irc}} | ||
{{Bind|PART|bind part <flags> <mask> <proc>|procname <nick> <user@host> <handle> <channel> <msg>|triggered by someone leaving the channel. The mask is matched against "#channel nick!user@host" and can contain wildcards. If no part message is specified, msg will be set to "". | {{Bind|PART|bind part <flags> <mask> <proc>|procname <nick> <user@host> <handle> <channel> <msg>|triggered by someone leaving the channel. The mask is matched against "#channel nick!user@host" and can contain wildcards. If no part message is specified, msg will be set to "". |
Revision as of 14:06, 4 January 2008
bind msg - stop msg:stop
unbind msg - stop msg:stop
Contents
Règles syntaxiques
Autant que faire se peut, nous essayons de normaliser l'écriture de la documentation.
Ce qui se trouve entre < et > est un argument modifiable par l'utilisateur dans la définition du bind ou un argument reçu par la procédure (il est alors fonction du "déclencheur"),
Nous essayons aussi de normaliser les termes employés et de garder leur nom en anglais car c'est ainsi que vous les trouverez dans la plupart des scripts Tcl.

Types de binds
Messages - Notices
MSG
Utilisé pour les commandes en message privé. Le premier mot du message est la commande, les autres sont pris comme des arguments texte.
- Syntaxe: bind msg <flags> <command> <proc>
- Procédure: procname <nick> <user@host> <handle> <text>
- Module: server
MSGM
Recherche un mot dans un message privé.
Si la procédure renvoit 1, Eggdrop n'enregistrera pas le message qui l'a déclenchée. Les binds MSGM sont traités avant les binds MSG. Si l'eggdrop est réglé avec l'option exclusive-binds, les binds MSG ne seront pas traités si un bind MSGM est déclenché.
- Syntaxe: bind msgm <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <text>
- Module: server
NOTC
wildcards
Note: les notices serveur ne déclenchent pas ce bind.
Si la procédure renvoit 1, Eggdrop n'enregistrera pas le message qui a déclenché le bind.
Les nouveaux Tcls doivent être déclaré comme ceci pour assurer la compatibilité:
proc notcproc {nick uhost hand text {dest ""}} {
global botnick; if {$dest == ""} {set dest $botnick}
...
}
- Syntaxe: bind notc <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <text> <dest>
- Module: server
RAW
Le keyword est soit un numérique, comme "368", ou un mot-clé comme "PRIVMSG". from est le serveur ou l'utilisateur qui envoit le message, les flags sont ignorés. L'ordre des argument est le même que l'ordre envoyé par le serveur IRC.
- Syntaxe: bind raw <flags> <keyword> <proc>
- Procédure: procname <from> <keyword> <text>
- Module: server
Canal
PUB
Utilisé pour une commande donnée sur un canal. Le premier mot devient la commande, ceux qui suivent deviennent les arguments text.
- Syntaxe: bind pub <flags> <command> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <text>
- Module: irc
PUBM
Comme MSGM
Si la procédure renvoit 1, Eggdrop n'enregistrera pas le message qui a déclenché le bind. PUBM est traité avant PUB. Si exclusive-bind est activé, les PUB ne seront pas déclenchés par un texte qui aura fait réagir PUBM.
- Syntaxe: bind pubm <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <text>
- Module: irc
JOIN
triggered by someone joining the channel. The mask in the bind is matched against "#channel nick!user@host" and can contain wildcards.
- Syntaxe: bind join <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel>
- Module: irc
PART
triggered by someone leaving the channel. The mask is matched against "#channel nick!user@host" and can contain wildcards. If no part message is specified, msg will be set to "".
New Tcl procs should be declared asproc partproc {nick uhost hand chan {msg ""}} { ... }
- Syntaxe: bind part <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <msg>
- Module: irc
TOPC
triggered by a topic change. mask can contain wildcards and is matched against '#channel <new topic>'.
- Syntaxe: bind topc <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <topic>
- Module: irc
KICK
triggered when someone is kicked off the channel. The mask is matched against '#channel target reason' where the target is the nickname of the person who got kicked (can contain wildcards).
The proc is called with the nick, user@host, and handle of the kicker, plus the channel, the nickname of the person who was kicked, and the reason.
- Syntaxe: bind kick <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <target> <reason>
- Module: irc
MODE
mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, such as "+m" or "-o". target will show the argument of the mode change (for o/v/b/e/I) or "" if the set mode does not take an argument. The bot's automatic response to a mode change will happen AFTER all matching Tcl procs are called. The mask will be matched against '#channel +/-modes' and can contain wildcards. If it is a server mode, nick will be "", user@host is the server name, and handle is *. Note that "target" was added in 1.3.17 and that this will break Tcl scripts that were written for pre-1.3.17 Eggdrop that use the mode binding. Also, due to a typo, mode binds were broken completely in 1.3.17 but were fixed in 1.3.18. Mode bindings are not triggered at all in 1.3.17. One easy example (from guppy) of how to support the "target" parameter in 1.3.18 and later and still remain compatible with older Eggdrop versions is:
- Old script looks as follows:
bind mode - * mode_proc
proc mode_proc {nick uhost hand chan mode} { ... }
- To make it work with 1.3.18+ and stay compatible with older bots, do:
bind mode - * mode_proc_fix
proc mode_proc_fix {nick uhost hand chan mode {target ""}} {
if {$target != ""} {append mode " $target"}
mode_proc $nick $uhost $hand $chan $mode
}
proc mode_proc {nick uhost hand chan mode} { ... }
- Syntaxe: bind mode <flags> <mask> <proc>
- Procédure: proc-name <nick> <user@host> <handle> <channel> <mode-change> <target>
- Module: irc
Utilisateur
SIGN
triggered by a signoff, or possibly by someone who got netsplit and never returned. The signoff message is the last argument to the proc. Wildcards can be used in the mask, which is matched against '#channel nick!user@host'.
- Syntaxe: bind sign <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <reason>
- Module: irc
NICK
triggered when someone changes nicknames. The mask is matched against '#channel newnick' and can contain wildcards. Channel is "*" if the user isn't on a channel (usually the bot not yet in a channel).
- Syntaxe: bind nick <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel> <newnick>
- Module: irc
SPLT
triggered when someone gets netsplit on the channel. Be aware that this may be a false alarm (it's easy to fake a netsplit signoff message on some networks); mask may contain wildcards and is matched against '#channel nick!user@host'. Anyone who is SPLT will trigger a REJN or SIGN within the next wait-split (defined in the config file) minutes.
- Syntaxe: bind splt <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel>
- Module: irc
REJN
someone who was split has rejoined. mask can contain wildcards, and is matched against '#channel nick!user@host'.
- Syntaxe: bind rejn <flags> <mask> <proc>
- Procédure: procname <nick> <user@host> <handle> <channel>
- Module: irc
DCC - Party-Line
DCC
used for partyline commands; the command is the first word and everything else becomes the text argument. The idx is valid until the user disconnects. After that, it may be reused, so be careful about storing an idx for long periods of time.
- Syntaxe: bind dcc <flags> <command> <proc>
- Procédure: procname <handle> <idx> <text>
- Module: core
CTCP
dest will be a nickname (the bot's nickname, obviously) or channel name. keyword is the ctcp command (which can contain wildcards), and text may be empty. If the proc returns 0, the bot will attempt its own processing of the ctcp command.
- Syntaxe: bind ctcp <flags> <keyword> <proc>
- Procédure: proc-name <nick> <user@host> <handle> <dest> <keyword> <text>
- Module: server
CTCR
just like ctcp, but this is triggered for a ctcp-reply (ctcp embedded in a notice instead of a privmsg)
- Syntaxe: bind ctcr <flags> <keyword> <proc>
- Procédure: proc-name <nick> <user@host> <handle> <dest> <keyword> <text>
- Module: server
CHON
when someone first enters the party-line area of the bot via dcc chat or telnet, this is triggered before they are connected to a chat channel (so, yes, you can change the channel in a 'chon' proc). mask is matched against the handle and supports wildcards. This is NOT triggered when someone returns from the file area, etc.
- Syntaxe: bind chon <flags> <mask> <proc>
- Procédure: proc-name <handle> <idx>
- Module: core
CHOF
triggered when someone leaves the party line to disconnect from the bot. mask is matched against the handle and can contain wildcards. Note that the connection may have already been dropped by the user, so don't send output to the idx.
- Syntaxe: bind chof <flags> <mask> <proc>
- Procédure: proc-name <handle> <idx>
- Module: core
Système de fichier
FIL
the same as DCC, except this is triggered if the user is in the file area instead of the party line
- Syntaxe: bind fil <flags> <command> <proc>
- Procédure: procname <handle> <idx> <text>
- Module: filesys
SENT
after a user has successfully downloaded a file from the bot, this binding is triggered. mask is matched against the handle of the user that initiated the transfer and supports wildcards. nick is the actual recipient (on IRC) of the file. The path is relative to the dcc directory (unless the file transfer was started by a script call to 'dccsend', in which case the path is the exact path given in the call to 'dccsend').
- Syntaxe: bind sent <flags> <mask> <proc>
- Procédure: proc-name <handle> <nick> <path/to/file>
- Module: transfer
RCVD
triggered after a user uploads a file successfully. mask is matched against the user's handle. nick is the IRC nickname that the file transfer originated from. The path is where the file ended up, relative to the dcc directory (usually this is your incoming dir).
- Syntaxe: bind rcvd <flags> <mask> <proc>
- Procédure: proc-name <handle> <nick> <path/to/file>
- Module: transfer
Botnet
BOT
triggered by a message coming from another bot in the botnet. The first word is the command and the rest becomes the text argument; flags are ignored.
- Syntaxe: bind bot <flags> <command> <proc>
- Procédure: proc-name <from-bot> <command> <text>
- Module: core
CHAT
when a user says something on the botnet, it invokes this binding. Flags are ignored; handle could be a user on this bot ("DronePup") or on another bot ("Eden@Wilde") and therefore you can't rely on a local user record. The mask is checked against the entire line of text and supports wildcards.
NOTE: If a BOT says something on the botnet, the BCST bind is invoked instead.
- Syntaxe: bind chat <flags> <mask> <proc>
- Procédure: proc-name <handle> <channel#> <text>
- Module: core
LINK
triggered when a bot links into the botnet. botname is the botnetnick of the bot that just linked in; via is the bot it linked through. The mask is checked against the botnetnick of the bot that linked and supports wildcards. flags are ignored.
- Syntaxe: bind link <flags> <mask> <proc>
- Procédure: proc-name <botname> <via>
- Module: core
A trier
DISC
triggered when a bot disconnects from the botnet for whatever reason. Just like the link bind, flags are ignored; mask is matched against the botnetnick of the bot that unlinked. Wildcards are supported in mask.
- Syntaxe: bind disc <flags> <mask> <proc>
- Procédure: proc-name <botname>
- Module: core
FILT
party line and file system users have their text sent through filt before being processed. If the proc returns a blank string, the text is considered parsed. Otherwise, the bot will use the text returned from the proc and continue parsing that
- Syntaxe: bind filt <flags> <mask> <proc>
- Procédure: procname <idx> <text>
- Module: core
NEED
this bind is triggered on certain events, like when the bot needs operator status or the key for a channel. The types are: op, unban, invite, limit, and key; the mask is matched against '#channel type' and can contain wildcards. flags are ignored. Exemple:
bind need - "% op" needop < handles only need op
bind need - "*" needall < handles all needs
- Syntaxe: bind need <flags> <mask> <proc>
- Procédure: procname <channel> <type>
- Module: irc
FLUD
any floods detected through the flood control settings (like 'flood-ctcp') are sent here before processing. If the proc returns 1, no further action is taken on the flood; if the proc returns 0, the bot will do its normal "punishment" for the flood. The flood types are: pub, msg, join, or ctcp (and can be masked to "*" for the bind); flags are ignored.
- Syntaxe: bind flud <flags> <type> <proc>
- Procédure: procname <nick> <user@host> <handle> <type> <channel>
- Module: server
NOTE
incoming notes (either from the party line, someone on IRC, or someone on another bot on the botnet) are checked against these binds before being processed. The mask is matched against the receiving handle and supports wildcards. If the proc returns 1, Eggdrop will not process the note any further. Flags are ignored.
- Syntaxe: bind note <flags> <mask> <proc>
- Procédure: procname <from> <to> <text>
- Module: core
ACT
when someone does an action on the botnet, it invokes this binding. flags are ignored; the mask is matched against the text of the action and can support wildcards.
- Syntaxe: bind act <flags> <mask> <proc>
- Procédure: proc-name <handle> <channel#> <action>
- Module: core
WALL
when the bot receives a wallops, it invokes this binding. flags are ignored; the mask is matched against the text of the wallops msg. Note that RFC shows the server name as a source of the message, whereas many IRCds send the nick!user@host of the actual sender, thus, Eggdrop will not parse it at all, but simply pass it to bind in its original form. If the proc returns 1, Eggdrop will not log the message that triggered this bind.
- Syntaxe: bind wall <flags> <mask> <proc>
- Procédure: proc-name <from> <msg>
- Module: server
BCST
when a bot broadcasts something on the botnet (see 'dccbroadcast' above), it invokes this binding. flags are ignored; the mask is matched against the message text and can contain wildcards. 'channel' argument will always be '-1' since broadcasts are not directed to any partyline channel.
It is also invoked when a BOT (not a person, as with the CHAT bind) 'says' something on a channel. In this case, the 'channel' argument will be a valid channel, and not '-1'.
- Syntaxe: bind bcst <flags> <mask> <proc>
- Procédure: proc-name <botname> <channel#> <text>
- Module: core
CHJN
when someone joins a botnet channel, it invokes this binding. The mask is matched against the channel and can contain wildcards. flag is one of: * (owner), + (master), @ (op), or % (botnet master). Flags are ignored.
- Syntaxe: bind chjn <flags> <mask> <proc>
- Procédure: proc-name <botname> <handle> <channel#> <flag> <idx> <user@host>
- Module: core
CHPT
when someone parts a botnet channel, it invokes this binding. The mask is matched against the channel and can contain wildcards. Flags are ignored.
- Syntaxe: bind chpt <flags> <mask> <proc>
- Procédure: proc-name <botname> <handle> <idx> <channel#>
- Module: core
TIME
allows you to schedule procedure calls at certain times. mask matches 5 space separated integers of the form: "minute hour day month year". minute, hour, day, month have a zero padding so they are exactly two characters long; year is four characters. Flags are ignored.
- Syntaxe: bind time <flags> <mask> <proc>
- Procédure: proc-name <minute> <hour> <day> <month> <year>
- Module: core
AWAY
triggers when a user goes away or comes back on the botnet. text is the reason than has been specified (text is "" when returning). mask is matched against the botnet-nick of the bot the user is connected to and supports wildcards. flags are ignored.
- Syntaxe: bind away <flags> <mask> <proc>
- Procédure: proc-name <botname> <idx> <text>
- Module: core
{{Bind|LOAD (stackable)
bind load <flags> <mask> <proc> proc-name <module>
Description: triggers when a module is loaded. mask is matched against the name of the loaded module and supports wildcards; flags are ignored. Module: core
UNLD
triggers when a module is unloaded. mask is matched against the name of the unloaded module and supports wildcards; flags are ignored.
- Syntaxe: bind unld <flags> <mask> <proc>
- Procédure: proc-name <module>
- Module: core
NKCH
triggered whenever a local user's handle is changed (in the userfile). mask is matched against the user's old handle and can contain wildcards; flags are ignored.
- Syntaxe: bind nkch <flags> <mask> <proc>
- Procédure: proc-name <oldhandle> <newhandle>
- Module: core
EVNT
triggered whenever one of these events happen. flags are ignored; valid events are:
- sighup - called on a kill -HUP <pid>
- sigterm - called on a kill -TERM <pid>
- sigill - called on a kill -ILL <pid>
- sigquit - called on a kill -QUIT <pid>
- save - called when the userfile is saved
- rehash - called just after a rehash
- prerehash - called just before a rehash
- prerestart - called just before a restart
- logfile - called when the logs are switched daily
- loaded - called when the bot is done loading
- userfile-loaded - called after userfile has been loaded
- connect-server - called just before we connect to an IRC server
- init-server - called when we actually get on our IRC server
- disconnect-server - called when we disconnect from our IRC server
- Syntaxe: bind evnt <flags> <type> <proc>
- Procédure: proc-name <type>
- Module: core
LOST
triggered when a DCC SEND transfer gets lost, such as when the connection is terminated before all data was successfully sent/received. This is typically caused by a user abort.
- Syntaxe: bind lost <flags> <mask> <proc>
- Procédure: proc-name <handle> <nick> <path> <bytes-transferred> <length-of-file>
- Module: transfer
TOUT
triggered when a DCC SEND transfer times out. This may either happen because the dcc connection was not accepted or because the data transfer stalled for some reason.
- Syntaxe: bind tout <flags> <mask> <proc>
- Procédure: proc-name <handle> <nick> <path> <bytes-transferred> <length-of-file>
- Module: transfer