~pkal/irc.awk

ref: 0640248b7351bbd4dbbc0c66d499662ad62275bc irc.awk/DOCUMENTATION -rw-r--r-- 3.3 KiB
0640248bPhilip Kaludercic Update irc_setup usage in README 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
* irc.awk Documentation				-*- mode: outline -*-

irc.awk is an IRC library written for GNU AWK.

** Functions


*** irc_setup(host, port, nick, autojoin, user, realname, passwd)
This function must be called for initializing the library.
The first three arguments "host", "port" and "nick" are the only
necessary ones, and designate what host to connect to, via what port
and using what name. Port may contain the string "ssl" if the library
should connect to the port 6697 via an encrypted connection.

"autojoin" should be a string of channels the bit is to automatically
join, each separated by a white space. Alternatively, a preceding "!"
indicates that the bot is to join all channels it is invited into.

"user" and "realname" set the IRC user and real name.

"passwd" is used when the server requires a password to connect.

*** irc_join(chan, passwd)
Make the bot join "chan". Optionally, "passwd" may be passed if a
password is necessary.

*** irc_send(to, msg)
Send a PRIVMGS "msg" to user "to".

*** irc_msg(msg)
Send a PRIVMSG to the actor/channel that triggered the current event.

*** irc_quit(quitmsg, _msg, _len)
Terminate the current connection with message "quitmsg". The variables
_msg and _len are local variables that shouldn't set.


*** READ(pat, to)
True when the message body of the current even matches
"pat". Optionally the argument "to" ensures what channel this message
was directed at.

*** FROM(pat, to)
True when the current event was triggered by a user matching PAT.
Optionally the argument "to" ensures what channel this message was
directed at.

*** JOINED(pat, to)
True when a user joined and their nick matches PAT. Optionally the
argument "to" ensures what channel this message was directed at.

*** MENTIONED(to)
True when the bot was mentioned. Optionally the argument "to" ensures
what channel this message was directed at.

** Variables


*** irc_autojoin_invite
If true, the bot joins every channel it is invited into. This is the
same behaviour as when irc_setup's "autojoin" parameter starts with an
exclamation point.

*** irc_rooms
A 2D "matrix" with metadata on all the channels. The first level
indexes channel names, the second level indexes attributes.

Currently the only attribute implemented is "topic".


*** TO
Event-specific variable indicating in what channel an event took
place.

*** WHO
Event-specific variable indicating who triggered the current event.

*** MGS
Event-specific variable containing the PRIVMSG message body, or a
false value if there is no message

*** EMSG
Event-specific variable containing the "event" message body, such as
the reason a user left a channel.

*** NOTICE
Same function as MSG, just for NOTICE events.

*** INVITE
Event-specific variable containing the channel name a user has been
invited to.

*** JOIN
Event-specific variable that is non-nil, when someone just joined a
channel.

*** PART
Event-specific variable that is non-nil, when someone just parted a
channel.

*** QUIT
Event-specific variable that is non-nil, when someone just quit a
connection.

*** KICK
Event-specific variable that is non-nil, when someone just kicked
from a channel.

** Internal variables and functions
All non-public parts of irc.awk are prefixed with "__irc_". While
accessible, they shouldn't be used/manipulated, as  irc.awk neither
guarantees consistency between future and past versions, nor does it
expect these to be changed.