[][src]Struct twitchchat::Encoder

pub struct Encoder<W> { /* fields omitted */ }

An encoder for messages

Methods

impl<W> Encoder<W> where
    W: Write
[src]

pub fn into_inner(self) -> W[src]

Gets the inner writer out

pub fn inner(&mut self) -> &mut W[src]

Get a mutable borrow of the inner writer

pub fn new(writer: W) -> Self[src]

Make a new encoder from this writer

impl<W> Encoder<W> where
    W: Write
[src]

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

Permanently prevent a user from chatting. Reason is optional and will be shown to the target user and other moderators.

Use unban to remove a ban.

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

Clear chat history for all users in this room.

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

Change your username color.

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

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

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

Triggers a commercial.

Length (optional) must be a positive number of seconds.

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

Reconnects to chat.

pub fn emote_only(&mut self) -> Result<()>[src]

Enables emote-only mode (only emoticons may be used in chat).

Use emote_only_off to disable.

pub fn emote_only_off(&mut self) -> Result<()>[src]

Disables emote-only mode.

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

Enables followers-only mode (only users who have followed for duration may chat).

Examples: "30m", "1 week", "5 days 12 hours".

Must be less than 3 months.

pub fn followers_off(&mut self) -> Result<()>[src]

Disables followers-only mode.

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

Grant moderator status to a user.

Use mods to list the moderators of this channel.

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

Lists the commands available to you in this room.

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

Host another channel.

Use unhost to unset host mode.

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

Join a channel

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

Adds a stream marker (with an optional comment, max 140 characters) at the current timestamp.

You can use markers in the Highlighter for easier editing.

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

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

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

Lists the moderators of this channel.

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

Leave a channel

pub fn ping(&mut self, token: &str) -> Result<()>[src]

Request a heartbeat with the provided token

pub fn pong(&mut self, token: &str) -> Result<()>[src]

Response to a heartbeat with the provided token

pub fn privmsg(&mut self, target: &str, data: &str) -> Result<()>[src]

Send data to a target

pub fn r9k_beta(&mut self) -> Result<()>[src]

Enables r9k mode.

Use r9k_beta_off to disable.

pub fn r9k_beta_off(&mut self) -> Result<()>[src]

Disables r9k mode.

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

Raid another channel.

Use unraid to cancel the Raid.

pub fn raw(&mut self, raw: impl AsRef<[u8]>) -> Result<()>[src]

Send a raw IRC-style message

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

Enables slow mode (limit how often users may send messages).

Duration (optional, default=120) must be a positive number of seconds.

Use slow_off to disable.

pub fn slow_off(&mut self) -> Result<()>[src]

Disables slow mode.

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

Enables subscribers-only mode (only subscribers may chat in this channel).

Use subscribers_off to disable.

pub fn subscribers_off(&mut self) -> Result<()>[src]

Disables subscribers-only mode.

pub fn timeout<'a, 'b>(
    &mut self,
    username: &str,
    duration: impl Into<Option<&'a str>>,
    message: impl Into<Option<&'b str>>
) -> Result<()>
[src]

Temporarily prevent a user from chatting.

  • duration (optional, default=10 minutes) must be a positive integer.
  • time unit (optional, default=s) must be one of
    • s
    • m
    • h
    • d
    • w
  • maximum duration is 2 weeks.

Combinations like 1d2h are also allowed.

Reason is optional and will be shown to the target user and other moderators.

Use untimeout to remove a timeout.

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

Removes a ban on a user.

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

Stop hosting another channel.

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

Revoke moderator status from a user.

Use mods to list the moderators of this channel.

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

Cancel the Raid.

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

Removes a timeout on a user.

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

Revoke VIP status from a user.

Use vips to list the VIPs of this channel.

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

Grant VIP status to a user.

Use vips to list the VIPs of this channel.

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

Lists the VIPs of this channel.

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

Whispers the message to the username.

Trait Implementations

impl<W: Write + Clone> Clone for Encoder<W>[src]

impl<W> Debug for Encoder<W>[src]

impl<W: Write + Default> Default for Encoder<W>[src]

Auto Trait Implementations

impl<W> RefUnwindSafe for Encoder<W> where
    W: RefUnwindSafe

impl<W> Send for Encoder<W> where
    W: Send

impl<W> Sync for Encoder<W> where
    W: Sync

impl<W> Unpin for Encoder<W> where
    W: Unpin

impl<W> UnwindSafe for Encoder<W> where
    W: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.