irc_bot/core/
reaction.rs

1use std::borrow::Cow;
2use std::fmt;
3
4#[derive(Debug)]
5pub enum Reaction {
6    None,
7    Msg(Cow<'static, str>),
8    Msgs(Cow<'static, [Cow<'static, str>]>),
9    Reply(Cow<'static, str>),
10    Replies(Cow<'static, [Cow<'static, str>]>),
11    RawMsg(Cow<'static, str>),
12    Quit(Option<Cow<'static, str>>),
13}
14
15#[derive(Debug)]
16pub enum ErrorReaction {
17    Proceed,
18    Quit(Option<Cow<'static, str>>),
19}
20
21/// Copied from `yak-irc`'s `Reaction`.
22#[derive(Clone, Debug)]
23pub enum LibReaction<Msg>
24where
25    Msg: Clone + fmt::Debug,
26{
27    /// React by sending an IRC message. No line-wrapping or other formatting will be performed on
28    /// the message, except that the message-terminating sequence of a carriage return character
29    /// and a line feed character ("CR-LF") will be appended. If the message exceeds 512 octets in
30    /// length (including the terminating CR-LF sequence, but excluding any IRCv3 message tags), it
31    /// may be truncated to 512 octets.
32    RawMsg(Msg),
33
34    /// Return multiple reactions, which will be processed in the order given.
35    Multi(Vec<LibReaction<Msg>>),
36}