[][src]Struct twitchchat::Encoder

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

An encoder for messages

Implementations

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

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

Gets the inner writer out

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

Get a mutable borrow of the inner writer

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

Get a borrow of the inner writer

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

Make a new encoder from this writer

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

pub fn ban<'a>(
    &mut self,
    channel: impl IntoChannel,
    username: &str,
    reason: impl Into<Option<&'a str>>
) -> Result<(), Error>
[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, channel: impl IntoChannel) -> Result<(), Error>[src]

Clear chat history for all users in this room.

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

Change your username color.

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

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

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

Sends the command: data to the 'jtv' channel (e.g. /color #FFFFFF)

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

Triggers a commercial.

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

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

Reconnects to chat.

pub fn emote_only(&mut self, channel: impl IntoChannel) -> Result<(), Error>[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, channel: impl IntoChannel) -> Result<(), Error>[src]

Disables emote-only mode.

pub fn followers(
    &mut self,
    channel: impl IntoChannel,
    duration: &str
) -> Result<(), Error>
[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, channel: impl IntoChannel) -> Result<(), Error>[src]

Disables followers-only mode.

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

Grant moderator status to a user.

Use mods to list the moderators of this channel.

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

Lists the commands available to you in this room.

pub fn host(
    &mut self,
    source: impl IntoChannel,
    target: impl IntoChannel
) -> Result<(), Error>
[src]

Host another channel.

Use unhost to unset host mode.

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

Join a channel

pub fn marker<'a>(
    &mut self,
    channel: impl IntoChannel,
    comment: impl Into<Option<&'a str>>
) -> Result<(), Error>
[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.

If the string exceeds 140 characters then it will be truncated

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

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

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

Lists the moderators of this channel.

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

Leave a channel

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

Request a heartbeat with the provided token

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

Response to a heartbeat with the provided token

pub fn privmsg(
    &mut self,
    channel: impl IntoChannel,
    data: impl AsRef<str>
) -> Result<(), Error>
[src]

Send data to a channel

pub fn r9k_beta(&mut self, channel: impl IntoChannel) -> Result<(), Error>[src]

Enables r9k mode.

Use r9k_beta_off to disable.

pub fn r9k_beta_off(&mut self, channel: impl IntoChannel) -> Result<(), Error>[src]

Disables r9k mode.

pub fn raid(
    &mut self,
    source: impl IntoChannel,
    target: impl IntoChannel
) -> Result<(), Error>
[src]

Raid another channel.

Use unraid to cancel the Raid.

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

Send a raw IRC-style message

pub fn slow(
    &mut self,
    channel: impl IntoChannel,
    duration: impl Into<Option<usize>>
) -> Result<(), Error>
[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, channel: impl IntoChannel) -> Result<(), Error>[src]

Disables slow mode.

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

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

Use subscribers_off to disable.

pub fn subscribers_off(
    &mut self,
    channel: impl IntoChannel
) -> Result<(), Error>
[src]

Disables subscribers-only mode.

pub fn timeout<'a, 'b>(
    &mut self,
    channel: impl IntoChannel,
    username: &str,
    duration: impl Into<Option<&'a str>>,
    message: impl Into<Option<&'b str>>
) -> Result<(), Error>
[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,
    channel: impl IntoChannel,
    username: impl AsRef<str>
) -> Result<(), Error>
[src]

Removes a ban on a user.

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

Stop hosting another channel.

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

Revoke moderator status from a user.

Use mods to list the moderators of this channel.

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

Cancel the Raid.

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

Removes a timeout on a user.

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

Revoke VIP status from a user.

Use vips to list the VIPs of this channel.

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

Grant VIP status to a user.

Use vips to list the VIPs of this channel.

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

Lists the VIPs of this channel.

pub fn whisper(
    &mut self,
    username: impl AsRef<str>,
    message: impl AsRef<str>
) -> Result<(), Error>
[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.