[][src]Struct twitchchat::Writer

pub struct Writer { /* fields omitted */ }

A thread-safe, clonable writer for the Twitch client

Methods

impl Writer[src]

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

Host another channel.

Use Writer::unhost to unset host mode.

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

Stop hosting another channel.

pub fn marker(&self, comment: Option<&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.

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

Raid another channel.

Use Writer::unraid to cancel the Raid.

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

Cancel the Raid.

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

Change your username color.

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

Reconnects to chat.

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

Lists the commands available to you in this room.

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

Lists the moderators of this channel.

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

Lists the VIPs of this channel.

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

Triggers a commercial.

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

pub fn ban(
    &self,
    username: impl Display,
    reason: Option<&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 Writer::unban to remove a ban.

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

Removes a ban on a user.

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

Clear chat history for all users in this room.

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

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

Use Writer::emoteonlyoff to disable.

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

Disables emote-only mode.

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

Disables followers-only mode.

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

Grant moderator status to a user.

Use Writer::mods to list the moderators of this channel.

(NOTE: renamed to op because r#mod is annoying to type)

pub fn mod(&self, username: impl Display) -> Result<(), Error>[src]

Grant moderator status to a user. (See Writer::op for an alternative name)

Use Writer::mods to list the moderators of this channel.

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

Revoke moderator status from a user.

Use Writer::mods to list the moderators of this channel.

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

Enables r9k mode.

Use Writer::r9kbetaoff to disable.

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

Disables r9k mode.

pub fn slow(&self, duration: 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 Writer::slowoff to disable.

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

Disables slow mode.

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

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

Use Writer::subscribersoff to disable.

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

Disables subscribers-only mode.

pub fn timeout(
    &self,
    username: impl Display,
    duration: Option<&str>,
    reason: Option<&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 Writer::untimeout to remove a timeout.

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

Removes a timeout on a user.

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

Grant VIP status to a user.

Use Writer::vips to list the VIPs of this channel.

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

Revoke VIP status from a user.

Use Writer::vips to list the VIPs of this channel.

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

Whispers the message to the username.

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

Joins a channel

This ensures the channel name is lowercased and begins with a '#'.

The following are equivilant

This example is not tested
let w = client.writer();
w.join("museun").unwrap();
w.join("#museun").unwrap();
w.join("Museun").unwrap();
w.join("#MUSEUN").unwrap();

pub fn shutdown_client(&self)[src]

This is used to signal to the Client to shutdown

pub fn join_many<'a, I>(&self, channels: I) -> Result<(), Error> where
    I: IntoIterator + 'a,
    I::Item: AsRef<str> + 'a, 
[src]

Join many channels (from an iterator)

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

Parts a channel

This ensures the channel name is lowercased and begins with a '#'.

The following are equivilant

This example is not tested
let w = client.writer();
w.part("museun").unwrap();
w.part("#museun").unwrap();
w.part("Museun").unwrap();
w.part("#MUSEUN").unwrap();

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

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

This ensures the channel name is lowercased and begins with a '#'.

pub fn privmsg(
    &self,
    channel: impl IntoChannel,
    message: impl Display
) -> Result<(), Error>
[src]

Sends the message to the channel

This ensures the channel name is lowercased and begins with a '#'.

Same as send

pub fn send(
    &self,
    channel: impl IntoChannel,
    message: impl Display
) -> Result<(), Error>
[src]

Sends the message to the channel

This ensures the channel name is lowercased and begins with a '#'.

Same as privmsg

pub fn command(&self, data: impl Display) -> Result<(), Error>[src]

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

pub fn raw(&self, data: impl Display) -> Result<(), Error>[src]

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

Trait Implementations

impl Clone for Writer[src]

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

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Sync for Writer

impl Send for Writer

impl Unpin for Writer

impl RefUnwindSafe for Writer

impl UnwindSafe for Writer

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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