Class twitch
twitch.lua A Twitch client written in Lua
Info:
- Release: 0.5
- License: MIT
- Author: Rafael Alcalde Azpiazu
Methods
| twitch.connect (nickname, token) | Connects with Twitch IRC server and returns a client |
| twitch:join (channel) | Joins to a channel |
| twitch:leave (channel) | Leaves a channel |
| twitch:send ([channel], text) | Prints a message |
| twitch:attach (command[, channel], func) | Attaches a function to a command |
| twitch:detach (command[, channel]) | Detaches a command |
| twitch:settimer (name, seconds, func) | Adds a timer that executes a command every n seconds |
| twitch:removetimer (name) | Removes a timer |
| twitch:loop (check_exit) | Runs a loop that receives al changes in the joined channels and executes their commands |
| twitch:close () | Leaves all channels and close the connection |
Methods
- twitch.connect (nickname, token)
-
Connects with Twitch IRC server and returns a client
Parameters:
- nickname the username that the chatbot uses to send chat messages
- token the token to authenticate your chatbot with Twitch's servers.
Returns:
-
a twitch client
- twitch:join (channel)
-
Joins to a channel
Parameters:
- channel the name of the channel
- twitch:leave (channel)
-
Leaves a channel
Parameters:
- channel the name of the channel
- twitch:send ([channel], text)
-
Prints a message
Parameters:
- channel the channel which will send, nil to broadcast (optional)
- text the message to send
- twitch:attach (command[, channel], func)
-
Attaches a function to a command
Parameters:
- command the command name
- channel the channel name, nil to attach the command to all channels (optional)
- func the function of the command. It receives the following arguments: twitch client, channel, username, command args.
- twitch:detach (command[, channel])
-
Detaches a command
Parameters:
- command the command name
- channel the channel name, nil to detach the command in all channels (optional)
- twitch:settimer (name, seconds, func)
-
Adds a timer that executes a command every n seconds
Parameters:
- name the name of the timer
- seconds the elapsed time to fire the command
- func the function that be launched. The first argument will be the client
- twitch:removetimer (name)
-
Removes a timer
Parameters:
- name The name of the timer to remove
- twitch:loop (check_exit)
-
Runs a loop that receives al changes in the joined channels and executes their commands
Parameters:
- check_exit
- twitch:close ()
- Leaves all channels and close the connection