[][src]Module ttv_chat::messages

Twitch messages that can be parsed from IrcMessage, or subscribed to from the Dispatcher

Converting from an IrcMessage to a specific message

let input = ":user!user@user PRIVMSG #test_channel :this is some data\r\n";
let irc_msg = twitchchat::irc::parse(input).next().unwrap().unwrap();

// this is implemented for all of the types in this module
use twitchchat::FromIrcMessage;
use twitchchat::messages::Privmsg;
// this will produce an error if its not this type of message
let pm = Privmsg::from_irc(irc_msg).unwrap();
assert_eq!(pm.data(), "this is some data");

Converting an IrcMessage to an enum of all possible messages

let input = ":user!user@user PRIVMSG #test_channel :this is some data\r\n";
let irc_msg = twitchchat::irc::parse(input).next().unwrap().unwrap();

// this is implemented for all of the tyupes in this module
use twitchchat::FromIrcMessage;
use twitchchat::messages::Commands;

let all = Commands::from_irc(irc_msg).unwrap();
assert!(matches!(all, Commands::Privmsg{..}));

Structs

Cap

Acknowledgement (or not) on a CAPS request

ClearChat

When a user's message(s) have been purged.

ClearMsg

When a single message has been removed from a channel.

GlobalUserState

Sent on successful login, if TAGS capability have been sent beforehand.

HostTarget

When a channel starts to host another channel

IrcMessage

A raw irc message @tags :prefix COMMAND args :data\r\n

IrcReady

Happens when the IRC connection has been succesfully established

Join

User join message

Notice

General notices from the server.

Part

User leave message

Ping

A ping request from the server

Pong

A pong response sent from the server

Privmsg

Message sent by a user

Ready

An event that is produced when the Twitch connection has been succesfully established

Reconnect

Signals that you should reconnect and rejoin channels after a restart.

RoomState

Identifies the channel's chat settings (e.g., slow mode duration).

UserNotice

Announces Twitch-specific events to the channel (e.g., a user's subscription notification).

UserState

Identifies a user's chat settings or properties (e.g., chat color)..

Whisper

Message sent by another user to your user (a 'DM')

Enums

Capability

A parsed Capability

Commands

An enum of all possible Twitch messages.

FollowersOnly

The parameters for a room being in follower-only mode

HostTargetKind

Event kind for determine when a Host event beings or end

MessageId

These tags apply to both the NOTICE (Twitch Commands) and NOTICE (Twitch Chat Rooms) commands.

NoticeType

The kind of notice it was, retrieved via UserNotice::msg_id

SubPlan

A paid subscription ot the channel