2024-03-02 08:11:50 +00:00
|
|
|
# API
|
|
|
|
|
2024-03-02 08:30:15 +00:00
|
|
|
## 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
|
2024-03-02 08:11:50 +00:00
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `raw(message)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Sends a raw message to the server.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `privmsg(to, message)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Sends a message to a channel or user.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `notice(to, message)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Sends a notice to a channel or user.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `join(channel)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Joins a channel.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `part(channel, reason)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Leaves a channel.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `kick(channel, user, reason)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Kicks a user from a channel. Reason is optional.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `mode(channel, mode, target)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Sets a mode on a channel.
|
|
|
|
|
2024-03-02 08:16:58 +00:00
|
|
|
### `ctcp(to, message)`
|
2024-03-02 08:11:50 +00:00
|
|
|
|
|
|
|
Sends a CTCP message to a channel or user.
|
|
|
|
|