Parse usernames out of /mods and /vips messages (#3187)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2021-10-24 13:28:43 +00:00
committed by GitHub
parent 5112ec73b0
commit 5f7caebce0
4 changed files with 74 additions and 0 deletions
@@ -834,6 +834,31 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
hostOn);
channel->addMessage(builder.release());
}
else if (tags == "room_mods" || tags == "vips_success")
{
// /mods and /vips
// room_mods: The moderators of this channel are: ampzyh, antichriststollen, apa420, ...
// vips_success: The VIPs of this channel are: 8008, aiden, botfactory, ...
QString noticeText = msg->messageText;
if (tags == "vips_success")
{
// this one has a trailing period, need to get rid of it.
noticeText.chop(1);
}
QStringList msgParts = noticeText.split(':');
MessageBuilder builder;
auto tc = dynamic_cast<TwitchChannel *>(channel.get());
assert(tc != nullptr &&
"IrcMessageHandler::handleNoticeMessage. Twitch specific "
"functionality called in non twitch channel");
TwitchMessageBuilder::modsOrVipsSystemMessage(
msgParts.at(0), msgParts.at(1).split(", "), tc, &builder);
channel->addMessage(builder.release());
}
else
{
channel->addMessage(msg);