Module irc::client
[−]
[src]
A simple, thread-safe, and async-friendly IRC client library.
This API provides the ability to connect to an IRC server via the
IrcClient
type. The Client
trait that
IrcClient
implements provides methods for communicating with the
server. An extension trait, ClientExt
, provides short-hand for
sending a variety of important messages without referring to their entries in
proto::command
.
Examples
Using these APIs, we can connect to a server and send a one-off message (in this case, identifying with the server).
use irc::client::prelude::{IrcClient, ClientExt}; let client = IrcClient::new("config.toml").unwrap(); // identify comes from `ClientExt` client.identify().unwrap();
We can then use functions from Client
to receive messages from the
server in a blocking fashion and perform any desired actions in response. The following code
performs a simple call-and-response when the bot's name is mentioned in a channel.
use irc::client::prelude::{Client, Command}; client.for_each_incoming(|irc_msg| { if let Command::PRIVMSG(channel, message) = irc_msg.command { if message.contains(client.current_nickname()) { client.send_privmsg(&channel, "beep boop").unwrap(); } } }).unwrap();
Modules
conn |
A module providing IRC connections for use by |
data |
Data related to IRC functionality. |
ext |
Utilities and shortcuts for working with IRC servers. |
prelude |
A client-side IRC prelude, re-exporting the complete high-level IRC client API. |
reactor |
A system for creating and managing IRC client connections. |
transport |
An IRC transport that wraps an IRC-framed stream to provide a number of features including automatic PING replies, automatic sending of PINGs, and message rate-limiting. |
Structs
ClientStream |
A stream of |
IrcClient |
The canonical implementation of a connection to an IRC server. |
IrcClientFuture |
A future representing the eventual creation of an |
PackedIrcClient |
An |
Traits
Client |
An interface for communicating with an IRC server. |
EachIncomingExt |
Trait extending all IRC streams with |