tmi.ex
Connect to Twitch chat with Elixir.
Inspired by tmi.js.
Installation
The package can be installed by adding tmi
to your list of dependencies in mix.exs
:
def deps do
[
{:tmi, "~> 0.1.0"},
]
end
Documentation can be found at https://hexdocs.pm/tmi/readme.html.
Usage
You can use your own Twitch username, but it is recommended to make a new twitch account just for your bot. You'll also need an OAuth token for the password.
The simplest method to get an OAuth token (while logged in to the account your bot will be) use the Twitch Chat OAuth Password Generator.
To connect, start TMI
with:
config = [
user: "mybotusername",
pass: "oauth:mybotoauthtoken",
chats: ["mychat"]
]
{:ok, _pid} = TMI.start_link(config)
Config options
:user
- Twitch username of your bot user. (lowercase):pass
- OAuth token to use as a password, prefixed withoauth:
.:chats
- The list of chats to join. (lowercase):capabilities
- An optional list of:tmi
capabilities, defined here. Can be any of:"membership"
,"tags"
, and"commands"
. (lowercase)