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

Link to this function

add_handler(conn, handler)

View Source
@spec add_handler(TMI.Conn.t(), pid()) :: :ok

Add a new event handler process.

Link to this function

add_handler_async(conn, handler)

View Source
@spec 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
@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.

Link to this function

channel_users(conn, channel)

View Source
@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.

Link to this function

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

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

me(conn, channel, message)

View Source
@spec me(TMI.Conn.t(), String.t(), iodata()) ::
  :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

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.

Link to this function

remove_handler(conn, handler)

View Source
@spec remove_handler(TMI.Conn.t(), pid()) :: :ok

Remove an event handler process.

Link to this function

remove_handler_async(conn, handler)

View Source
@spec remove_handler_async(TMI.Conn.t(), pid()) :: :ok

Remove an event handler process, asynchronously

Link to this function

say(conn, channel, message)

View Source
@spec say(TMI.Conn.t(), String.t(), iodata()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send a channel message.

See ExIRC.Client.start_link/1.

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

Stop the client process.

Link to this function

whisper(conn, user, message)

View Source
@spec whisper(TMI.Conn.t(), String.t(), iodata()) ::
  :ok | {:error, :not_connected | :not_logged_in}

Send a whisper message to a user.