[−][src]Struct twitchchat::twitch::Client
Client is the IRC client for interacting with Twitch's chat.
Methods
impl<R, W> Client<R, W> where
R: Read,
W: Write,
[src]
R: Read,
W: Write,
pub fn new(read: R, write: W) -> Self
[src]
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]
F: Fn(T) + 'static + Send + Sync,
T: From<Message>,
T: MessageFilter,
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]
W: Write,
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]
&mut self,
username: &str,
duration: Option<&str>,
reason: Option<&str>
) -> Result<(), Error>
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]
C: Into<Channel>,
S: AsRef<str>,
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]
C: Into<Channel>,
S: AsRef<str>,
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]
C: Into<Channel>,
S: AsRef<str>,
Sends the message
to the channel
pub fn command<S>(&mut self, data: S) -> Result<(), Error> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Sends the command: data
(e.g. /color #FFFFFF
)
pub fn raw<S>(&mut self, data: S) -> Result<(), Error> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Sends a raw line (appends the required \r\n
)
Trait Implementations
impl<R, W: Write> ClientExt for Client<R, W>
[src]
fn inspect<F>(&mut self, f: F) where
F: Fn(String) + Send + Sync + 'static,
[src]
F: Fn(String) + Send + Sync + 'static,
fn remove_inspect(&mut self)
[src]
fn join_many<'a, I, S>(&mut self, channels: I) -> Result<(), Error> where
I: IntoIterator<Item = S> + 'a,
S: AsRef<str> + 'a,
[src]
I: IntoIterator<Item = S> + 'a,
S: AsRef<str> + 'a,
impl<R, W> Clone for Client<R, W>
[src]
Auto Trait Implementations
impl<R, W> Send for Client<R, W> where
R: Send,
W: Send,
R: Send,
W: Send,
impl<R, W> Sync for Client<R, W> where
R: Send,
W: Send,
R: Send,
W: Send,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,