IRC module


This module controls the bots interaction on IRC. Allows the bot to join channels, handles channel userlists etc.

  1. Config file settings
  2. Tcl commands
  3. Tcl bindings

1. Config file settings

Lines in bold are the lines that need to be included in the eggdrop config file if you want to use the share module.
Lines in bold italics are optional and only required if you wish to change the default behaviour for that particular feature.

This module provides basic irc support for your bot. You have to load this if you want your bot to come on irc.

Put this line into your eggdrop.conf file to load irc module:

loadmodule irc

There are also some variables you can to set in your config file:

set bounce-bans 1

Set this to 1 if you want to bounce all server bans

Valid settings are 0 and 1.

set bounce-modes 0

Set this to 1 if you want to bounce all the server modes

Valid settings are 0 and 1.

set max-modes 30

Set here the global limit for +b/+e/+I modes on your irc server. This limit is set to 30 on 2.10 ircd servers.

set max-bans 20

Set here the maximum number of bans you want eggdrop to put in a channel. Eggdrop wont place any more bans if this limit is reached.

set kick-fun 0

Set this to 1 if you want the bot to kick for control character/ctcp avalanches to a channel. Remember that if it does, as it won't ban them, it can be at the origin of a nice kick-flood.

Valid settings are 0 and 1.

set ban-fun 0

Set this to 1 if you want the bot to ban for control character/ctcp avalanches to a channel. Can prevent the above described kick-flood, but can also fill the banlist.

Valid settings are 0 and 1.

set learn-users 0

If you want people to introduce themself to eggdrop via 'hello', set this to 1.

Valid settings are 0 and 1.

set wait-split 300

Set here the time (in seconds) to wait for someone to return from a netsplit (i.e. wasop will expire afterwards).

Hint: Set this to 1500 on IRCNet, since it's nick delay stops after 30 minutes.

set wait-info 15

Set here the time (in seconds) that someone must have been off-channel before re-displaying their info

set mode-buf-length 200

Set this to the maximum number of bytes to send in the arguments to mode's sent to the server, most servers default this to 200, so it should be sufficient.

set no-chanrec-info 0

If you are so lame you want the bot to display peoples info lines, even when you are too lazy to add their chanrecs to a channel, set this to 1

*NOTE* This means *every* user with an info line will have their info display on EVERY channel they join (provided they have been gone longer than wait-info)

Valid settings are 0 and 1.

set revenge-mode 1

This settings defines how the bot should punish bad users when revenging.

There are four possible settings:

0 for deop
1 for deop and chattr +d #chan
2 for deop, chattr +d #chan and kick
3 for deop, chattr +d #chan, kick and ban.

Valid settings are 0-3

These were the core irc module settings. There are more settings for 'net-type' 1 and 5. net-type has to be set in the server module config section.

Use this settings only if you set 'net-type' to 1!

set bounce-exempts 0

Set this to 1 if you want to bounce all server exemptions (+e modes)

Valid settings are 0 and 1.

set bounce-invites 0

Set this to 1 if you want to bounce all server invitations (+I modes)

Valid settings are 0 and 1.

set max-exempts 20

Set here the maximum number of exempts you want eggdrop to put in a channel. Eggdrop wont place any more exempts if this limit is reached.

set max-invites 20

Set here the maximum number of invites you want eggdrop to put in a channel. Eggdrop wont place any more invites if this limit is reached.

Valid settings are 0 and 1.

set use-exempts 0 (Disabled by Default)

If you set this feature to 0 in your eggdrop config file, the bot wont use any exempts. This setting is set to 1 as a default in nettype 1

Valid settings are 0 and 1.

set use-invites 0 (Disabled by Default)

If you set this feature to 0 in your eggdrop config file, the bot wont use any invites. This setting is set to 1 as a default in nettype 1

Valid settings are 0 and 1.

set prevent-mixing 1

At the moment the current ircd version (2.10) doesn't support the mix of b,o and v modes with e and I modes. This might be changed in the future, so use 1 at the moment for this flag

Valid settings are 0 and 1.

Use these settings only if you set 'net-type' to 5!

set kick-method 1

If your network supports more users per kick command then 1, you change this behaviour here: Set X for x users at once or 0 for all at once.

set modes-per-line 3

Some networks allow you to stack lots of channel modes into one line. They're all guaranteed to support at least 3, so that's the default, but if you know your network supports more, you may want to adjust this value.

Valid settings are 3-6

set use-354 0

Set this to 1 if your network uses ircu2.10.01 specific /who requests, eggdrop can therefore ask only for exactly what's needed.

Valid settings are 0 and 1.

set rfc-compliant 1 (Disabled by default)

If your network doesn't use rfc 1459 compliant string matching routines, turn this to 0. All networks apart from Dalnet comply with rfc 1459, so you should only disable it on Dalnet or networks which use Dalnet's code.


2. Tcl commands

botisop <channel>

returns: "1" if the bot is an op on that channel; "0" otherwise

isop <nickname> <channel>

returns: "1" if someone by that nickname is on the channel and has chop; "0" otherwise

isvoice <nickname> <channel>

returns: "1" if someone by that nickname is on the channel and has voice (+v); "0" otherwise

onchan <nickname> <channel>

returns: "1" if someone by that nickname is on the bot's channel; "0" otherwise

botonchan <channel>

returns: "1" if the bot is on that channel; "0" otherwise

nick2hand <nickname> <channel>

returns: handle of the person on the channel with that nickname, if someone by that nickname is on the channel; "" otherwise
if <channel> is not specified, bot will check all of its channels
if <nickname> not found, returns ""
if <nickname> found but unknown, returns "*"

handonchan <handle> <channel>

returns: "1" if the the user@host for someone on the channel matches for the handle given; "0" otherwise

hand2nick <handle> <channel>

returns: nickname of the first person on the channel whose user@host matches that handle, if there is one; "" otherwise

chanbans <channel>

returns: a list of the current bans on the channel, each element is of the form {ban bywho age} age is seconds from the bots POV

ischanban <ban> <channel>

returns: "1" if that is a ban on the bot's channel

resetbans <channel>

removes all bans on the channel that aren't in the bot's ban list, and refreshes any bans that should be on the channel but aren't

returns: nothing

chanexempts <channel>

returns: a list of the current exempts on the channel, each element is of the form {exempt bywho age} age is seconds from the bots POV

ischanexempt <exempt> <channel>

returns: "1" if that is a exempt on the bot's channel

ischanjuped [channel]

returns: "1" if the channel is juped and bot is unable to join, "0" otherwise.

resetexempts <channel>

removes all exempts on the channel that aren't in the bot's exempt list, and refreshes any exempts that should be on the channel but aren't

returns: nothing

chaninvites <channel>

returns: a list of the current invites on the channel, each element is of the form {invite bywho age} age is seconds from the bots POV

ischaninvite <invite> <channel>

returns: "1" if that is a invite on the bot's channel

resetinvites <channel>

removes all invites on the channel that aren't in the bot's invite list, and refreshes any invites that should be on the channel but aren't

returns: nothing

resetchan <channel>

rereads in the channel info from the server

returns: nothing

getchanhost <nickname> <channel>

returns: user@host of that person if they are on the channel; {} otherwise

getchanjoin <nickname> <channel>

returns: timestamp of when that person joined the channel

onchansplit <nick> <channel>

returns: "1" if that nick is split from the channel; "0" otherwise

chanlist <channel> [flags[&chanflags]]

flags are any flags that are global flags, the '&' denotes to look for channel specific flags. Examples:

n (Botowner)
&n (Channel owner)
o&m (Global op, Channel master)

now you can use even more complex matching of flags, including +&- flags and & or | (and or or) matching

returns: list of nicknames currently on the bot's channel that have all of the flags specified; if no flags are given, all of the nicknames are returned

getchanidle <nickname> <channel>

returns: number of minutes that person has been idle; "0" if the specified user isn't even on the channel

getchanmode <channel>

returns: string of the type "+ntik key" for the channel specified

pushmode <channel> <mode> [arg]

sends out a channel mode change (ex: pushmode #lame +o goober) through the bot's queueing system; all the mode changes will be sent out at once (combined into one line as much as possible) after the script finishes, or when 'flushmode' is called

flushmode <channel>

forces all previously pushed channel mode changes to go out right now, instead of when the script is done (just for the channel specified)

topic <channel>

returns: string of the current topic on the specified channel


3. Tcl bindings

PUB

bind pub <flags> <command> <proc>
proc-name <nick> <user@host> <handle> <channel> <args>

used for commands given on a channel; just like MSG, the first word becomes the command and everything else is the argument string

PUBM (stackable)

bind pubm <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <text>

just like MSGM, except it's triggered by things said on a channel instead of things /msg'd to the bot; the mask is matched against the channel name followed by the text, i.e., "#nowhere hello there!", and can contain wildcards

JOIN (stackable)

bind join <flags> <mask> <proc>
proc-name <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

PART (stackable)

bind part <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <msg>

triggered by someone leaving the channel; as in JOIN, 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 as

proc partproc {nick uhost hand chan {msg ""}} {
  ...
}

for compatiblity

SIGN (stackable)

bind sign <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <reason>

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 <mask>, which contains the channel name

TOPC (stackable)

bind topc <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <topic>

triggered by a topic change; can use wildcards in <mask>, which is matched against the channel name and new topic

KICK (stackable)

bind kick <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <kicked-nick> <reason>

triggered when someone is kicked off the channel; the <mask> is matched against "#channel nick" where the nickname is of the person who got kicked off (can use 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; <flags> is unused here

NICK (stackable)

bind nick <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <newnick>

triggered when someone changes nicknames; wildcards are allowed; the mask is matched against "#channel newnick"

MODE (stackable)

bind mode <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <mode-change> <victim>

mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, like "+m" or "-o", and the victims nick is contained in <victim>; flags are ignored; the bot's automatic response to a mode change will happen AFTER all matching Tcl procs are called; the <mask> will have the channel prefixed (i.e., "#turtle +m")

if it is a server mode <nick> will be "", <user@host> is the server address and handle is *

note that "victim" was added in 1.3.23 and that this will break tcl scripts that were written for pre-1.3.23 versions and use this binding. An easy fix (by guppy) is as follows (example):

Old script looks as follows:
bind mode - * mode_proc
proc mode_proc {nick uhost hand chan mc} {
  ...
}

To make it work with 1.3.23+ and stay compatible with older bots, do:
bind mode - * mode_proc_fix
proc mode_proc_fix {nick uhost hand chan mc {victim ""}} {
  if {$victim != ""} {
    append mc "$victim"
  }
  mode_proc $nick $uhost $hand $chan $mc
}
proc mode_proc {nick uhost hand chan mc} {
  ...
}

SPLT (stackable)

bind splt <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel>

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); <mask> may contain wildcards, and is matched against the channel and nick!user@host just like join; anyone who is SPLT will trigger a REJN or SIGN within the next 15 minutes

REJN (stackable)

bind rejn <flags> <nick!user@host> <proc>
proc-name <nick> <user@host> <handle> <channel>

someone who was split has rejoined; <mask> can contain wildcards, and contains channel and nick!user@host just like join

NEED (stackable)

bind need <flags> <op/voice/unban/limit/invite> <proc>
proc-name <channel> <which>

when the bot needs one of the listed things, on a channel, this binding is called to allow resolving


© 1997 Robey Pointer
© 1999,2000 Eggheads