View Source TMI.Client (tmi.ex v0.5.0)

TMI wrapper for ExIRC.Client.

Link to this section 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.

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.

Link to this section Functions

Link to this function

add_handler(conn, handler)

View Source

Specs

add_handler(TMI.Conn.t(), pid()) :: :ok

Add a new event handler process.

Link to this function

add_handler_async(conn, handler)

View Source

Specs

add_handler_async(TMI.Conn.t(), pid()) :: :ok

Add a new event handler process, asynchronously.

Link to this function

channel_has_user?(conn, channel, user)

View Source

Specs

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.

Link to this function

channel_users(conn, channel)

View Source

Specs

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.

Specs

command(TMI.Conn.t(), iodata() | charlist()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send a raw IRC command to TMI IRC server.

Specs

connect_ssl(TMI.Conn.t()) :: :ok | {:error, any()}

Connect to a server with the provided server and port via SSL.

Specs

is_connected?(TMI.Conn.t()) :: boolean()

Determine if the provided client process has an open connection to a server.

Specs

is_logged_on?(TMI.Conn.t()) :: boolean() | {:error, :not_connected}

Determine if the provided client is logged on to a server.

Specs

join(TMI.Conn.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Join a channel.

Link to this function

kick(conn, channel, user, message \\ "")

View Source

Specs

kick(TMI.Conn.t(), String.t(), String.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Kick a user from a channel.

Specs

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> :>
Link to this function

me(conn, channel, message)

View Source

Specs

me(TMI.Conn.t(), String.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send an action message, i.e. (/me slaps someone with a big trout)

Link to this function

normalize_channel(channel)

View Source

Map channel names to channel names with the prepended "#".

examples

Examples

iex> TMI.Client.normalize_channel("#foo")
|> expect("")
"#foo"

iex> TMI.Client.normalize_channel("bar")
|> expect("")
"#bar"

Specs

part(TMI.Conn.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Leave a channel.

Specs

quit(TMI.Conn.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Quit the server.

Link to this function

remove_handler(conn, handler)

View Source

Specs

remove_handler(TMI.Conn.t(), pid()) :: :ok

Remove an event handler process.

Link to this function

remove_handler_async(conn, handler)

View Source

Specs

remove_handler_async(TMI.Conn.t(), pid()) :: :ok

Remove an event handler process, asynchronously

Link to this function

say(conn, channel, message)

View Source

Specs

say(TMI.Conn.t(), String.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send a channel message.

See ExIRC.Client.start_link/1.

Specs

stop(TMI.Conn.t()) :: :ok

Stop the client process.

Link to this function

whisper(conn, user, message)

View Source

Specs

whisper(TMI.Conn.t(), String.t(), String.t()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send a whisper message to a user.