[][src]Struct twitchchat::twitch::Client

pub struct Client<R, W> { /* fields omitted */ }

Client is the IRC client for interacting with Twitch's chat.

Methods

impl<R, W> Client<R, W> where
    R: Read,
    W: Write
[src]

pub fn new(read: R, write: W) -> Self[src]

Create a new Client from a Read, Write pair

pub fn run(self) -> Result<(), Error>[src]

Runs, consuming all messages. (pumping them through .on() filters)

pub fn register(&mut self, config: UserConfig) -> Result<(), Error>[src]

pub fn wait_for_ready(&mut self) -> Result<LocalUser, Error>[src]

Waits for the GLOBALUSERSTATE before continuing, discarding any messages received

Returns some useful information about your user

pub fn wait_for_irc_ready(&mut self) -> Result<String, Error>[src]

Like wait_for_ready but waits for the end of the IRC MOTD

This will generally happen before GLOBALUSERSTATE but don't rely on that

Returns the username assigned to you by the server

pub fn read_message(&mut self) -> Result<Message, Error>[src]

Reads a message

This can be an IRC Message, or a parsed Twitch Command Will automatically handle some ~tedious~ messages, like the /heartbeat/

impl<R, W> Client<R, W>[src]

pub fn on<F, T>(&mut self, f: F) where
    F: Fn(T) + 'static + Send + Sync,
    T: From<Message>,
    T: MessageFilter, 
[src]

When a message, matching the type of the closure, is received run this function with it.

impl<R, W> Client<R, W> where
    W: Write
[src]

pub fn host(&mut self, channel: &str) -> Result<(), Error>[src]

pub fn unhost(&mut self) -> Result<(), Error>[src]

pub fn marker(&mut self, comment: Option<&str>) -> Result<(), Error>[src]

pub fn raid(&mut self, channel: &str) -> Result<(), Error>[src]

pub fn unraid(&mut self) -> Result<(), Error>[src]

pub fn color<C: Into<Color>>(&mut self, color: C) -> Result<(), Error>[src]

pub fn disconnect(&mut self) -> Result<(), Error>[src]

pub fn help(&mut self) -> Result<(), Error>[src]

pub fn mods(&mut self) -> Result<(), Error>[src]

pub fn vips(&mut self) -> Result<(), Error>[src]

pub fn commercial(&mut self, length: Option<usize>) -> Result<(), Error>[src]

pub fn ban(&mut self, username: &str, reason: Option<&str>) -> Result<(), Error>[src]

pub fn unban(&mut self, username: &str) -> Result<(), Error>[src]

pub fn clear(&mut self) -> Result<(), Error>[src]

pub fn emoteonly(&mut self) -> Result<(), Error>[src]

pub fn emoteonlyoff(&mut self) -> Result<(), Error>[src]

pub fn followers(&mut self, duration: &str) -> Result<(), Error>[src]

pub fn followersoff(&mut self) -> Result<(), Error>[src]

pub fn op(&mut self, username: &str) -> Result<(), Error>[src]

pub fn unmod(&mut self, username: &str) -> Result<(), Error>[src]

pub fn r9kbeta(&mut self) -> Result<(), Error>[src]

pub fn r9kbetaoff(&mut self) -> Result<(), Error>[src]

pub fn slow(&mut self, duration: Option<usize>) -> Result<(), Error>[src]

pub fn slowoff(&mut self) -> Result<(), Error>[src]

pub fn subscribers(&mut self) -> Result<(), Error>[src]

pub fn subscribersoff(&mut self) -> Result<(), Error>[src]

pub fn timeout(
    &mut self,
    username: &str,
    duration: Option<&str>,
    reason: Option<&str>
) -> Result<(), Error>
[src]

pub fn untimeout(&mut self, username: &str) -> Result<(), Error>[src]

pub fn vip(&mut self, username: &str) -> Result<(), Error>[src]

pub fn unvip(&mut self, username: &str) -> Result<(), Error>[src]

pub fn whisper(&mut self, username: &str, message: &str) -> Result<(), Error>[src]

pub fn join<C: Into<Channel>>(&mut self, channel: C) -> Result<(), Error>[src]

Joins a channel

pub fn part<C: Into<Channel>>(&mut self, channel: C) -> Result<(), Error>[src]

Parts a channel

pub fn me<C, S>(&mut self, channel: C, message: S) -> Result<(), Error> where
    C: Into<Channel>,
    S: AsRef<str>, 
[src]

Sends an "emote" message in the third person to the channel

pub fn privmsg<C, S>(&mut self, channel: C, message: S) -> Result<(), Error> where
    C: Into<Channel>,
    S: AsRef<str>, 
[src]

Sends the message to the channel

Same as send

pub fn send<C, S>(&mut self, channel: C, message: S) -> Result<(), Error> where
    C: Into<Channel>,
    S: AsRef<str>, 
[src]

Sends the message to the channel

pub fn command<S>(&mut self, data: S) -> Result<(), Error> where
    S: AsRef<str>, 
[src]

Sends the command: data (e.g. /color #FFFFFF)

pub fn raw<S>(&mut self, data: S) -> Result<(), Error> where
    S: AsRef<str>, 
[src]

Sends a raw line (appends the required \r\n)

Trait Implementations

impl<R, W: Write> ClientExt for Client<R, W>[src]

impl<R, W> Clone for Client<R, W>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<R, W> Send for Client<R, W> where
    R: Send,
    W: Send

impl<R, W> Sync for Client<R, W> where
    R: Send,
    W: Send

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T