From f275caf11f13392cd11cd443019f3e4148b8694a Mon Sep 17 00:00:00 2001 From: Aaron Blakely Date: Sat, 2 Mar 2024 02:30:15 -0600 Subject: [PATCH] update lua mod readme --- mods/lua/README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/mods/lua/README.md b/mods/lua/README.md index 1155a9d..160fdb3 100755 --- a/mods/lua/README.md +++ b/mods/lua/README.md @@ -1,6 +1,48 @@ # API -## Lua Commands +## Events + +### Event Types + +- `PRIVMSG_SELF - user, host, message` +- `PRIVMSG_CHAN - user, host, channel, message` +- `JOIN - user, host, channel` +- `JOIN_MYSELF - channel` +- `PART - user, host, channel, reason` +- `PART_MYSELF - channel, reason` +- `QUIT - user, host, reason` +- `NICK - user, host, newnick` +- `NICK_MYSELF - newnick` +- `NICK_INUSE - newnick` +- `CTCP - user, host, to, message` +- `IRC_CONNECTED` +- `TICK` + +### `add_handler(event, handler)` + +Adds a handler for an event. + +Example: + +```lua +function msg(user, host, channel, message) + print(user .. " said: " .. message) +end + +add_handler(PRIVMSG_CHAN, msg) +``` + +### `del_handler(event, handler)` + +Removes a handler for an event. + +Example: + +```lua +del_handler(PRIVMSG_CHAN, msg) +``` + +## IRC Commands ### `raw(message)`