View Source TMI.Client (tmi.ex v0.7.0)
TMI wrapper for ExIRC.Client.
Summary
Functions
Add a new event handler process.
Add a new event handler process, asynchronously.
Determine if a user is present in the provided channel.
Get a list of users in the provided channel.
Send a raw IRC command to TMI IRC server.
Connect to a server with the provided server and port via SSL.
Determine if the provided client process has an open connection to a server.
Determine if the provided client is logged on to a server.
Join a channel.
Kick a user from a channel.
Get a list of the channels the client has joined.
Logon to a server.
Send an action message, i.e. (/me slaps someone with a big trout)
Map channel names to channel names with the prepended "#".
Leave a channel.
Quit the server.
Remove an event handler process.
Remove an event handler process, asynchronously
Send a channel message.
Stop the client process.
Send a whisper message to a user.
Functions
@spec add_handler(TMI.Conn.t(), pid()) :: :ok
Add a new event handler process.
@spec add_handler_async(TMI.Conn.t(), pid()) :: :ok
Add a new event handler process, asynchronously.
@spec channel_has_user?(TMI.Conn.t(), String.t(), String.t()) :: boolean() | {:error, :not_connected | :not_logged_in | :no_such_channel}
Determine if a user is present in the provided channel.
@spec channel_users(TMI.Conn.t(), String.t()) :: [String.t()] | {:error, :not_connected | :not_logged_in | :no_such_channel}
Get a list of users in the provided channel.
@spec command(TMI.Conn.t(), iodata()) :: :ok
Send a raw IRC command to TMI IRC server.
@spec connect_ssl(TMI.Conn.t()) :: :ok | {:error, any()}
Connect to a server with the provided server and port via SSL.
@spec is_connected?(TMI.Conn.t()) :: boolean()
Determine if the provided client process has an open connection to a server.
@spec is_logged_on?(TMI.Conn.t()) :: boolean() | {:error, :not_connected}
Determine if the provided client is logged on to a server.
@spec join(TMI.Conn.t(), String.t()) :: :ok | {:error, :not_connected | :not_logged_in}
Join a channel.
@spec kick(TMI.Conn.t(), String.t(), String.t(), String.t()) :: :ok | {:error, :not_connected | :not_logged_in}
Kick a user from a channel.
@spec list_channels(TMI.Conn.t()) :: [String.t()] | {:error, :not_connected | :not_logged_in}
Get a list of the channels the client has joined.
@spec logon(TMI.Conn.t()) :: :ok | {:error, :not_connected}
Logon to a server.
Your nickname (nick
) must be your Twitch username (login name) in lowercase.
A successful connection session looks like the following example:
< PASS oauth:<Twitch OAuth token>
< NICK <user>
> :tmi.twitch.tv 001 <user> :Welcome, GLHF!
> :tmi.twitch.tv 002 <user> :Your host is tmi.twitch.tv
> :tmi.twitch.tv 003 <user> :This server is rather new
> :tmi.twitch.tv 004 <user> :-
> :tmi.twitch.tv 375 <user> :-
> :tmi.twitch.tv 372 <user> :You are in a maze of twisty passages.
> :tmi.twitch.tv 376 <user> :>
Send an action message, i.e. (/me slaps someone with a big trout)
Map channel names to channel names with the prepended "#".
Examples
iex> TMI.Client.normalize_channel("#foo")
"#foo"
iex> TMI.Client.normalize_channel("bar")
"#bar"
@spec part(TMI.Conn.t(), String.t()) :: :ok | {:error, :not_connected | :not_logged_in}
Leave a channel.
@spec quit(TMI.Conn.t(), String.t()) :: :ok | {:error, :not_connected | :not_logged_in}
Quit the server.
@spec remove_handler(TMI.Conn.t(), pid()) :: :ok
Remove an event handler process.
@spec remove_handler_async(TMI.Conn.t(), pid()) :: :ok
Remove an event handler process, asynchronously
Send a channel message.
@spec stop(TMI.Conn.t()) :: :ok
Stop the client process.
@spec whisper(TMI.Conn.t(), String.t(), iodata()) :: :ok | {:error, :not_connected | :not_logged_in}
Send a whisper message to a user.