`ServerMessage::Generic` is hidden and doesn't allow parsing of command responses
Chronophylos opened this issue · 2 comments
If you send a /mods
, /vips
or any other command via PRIVMSG
it is impossible to parse the response sent by twitch.
It gets parsed as a ServerMessage::Generic(HiddenIRCMessage)
which is hidden and not publicly accessible, but required to get the result of a command.
This is a deliberate design choice. See the examples on the ServerMessage
documentation: https://docs.rs/twitch-irc/2.2.0/twitch_irc/message/enum.ServerMessage.html#examples
You should match on messages types you're interested in, and then use the rest => {}
block and let irc_message = IRCMessage::from(rest);
to get the underlying IRC message. This allows me as the library author to add parsing for more commands in the future without your code breaking.
Apart from that, I believe that the response sent by Twitch is a NOTICE
and should be parsed as a NoticeMessage
, no?
I think I just misread my log an thought the response is a Generic