Don't crash upon right-clicking automod badge (#3496)

This commit is contained in:
Paweł
2022-01-14 02:44:13 +01:00
committed by GitHub
parent 820099821a
commit 700c9fc4f2
3 changed files with 18 additions and 13 deletions
+12 -8
View File
@@ -28,6 +28,14 @@ MessagePtr makeSystemMessage(const QString &text, const QTime &time)
return MessageBuilder(systemMessage, text, time).release();
}
EmotePtr makeAutoModBadge()
{
return std::make_shared<Emote>(Emote{
EmoteName{}, ImageSet{Image::fromPixmap(getResources().twitch.automod)},
Tooltip{"AutoMod"},
Url{"https://dashboard.twitch.tv/settings/moderation/automod"}});
}
MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
{
auto builder = MessageBuilder();
@@ -37,10 +45,8 @@ MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
builder.message().flags.set(MessageFlag::PubSub);
// AutoMod shield badge
builder
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
MessageElementFlag::BadgeChannelAuthority)
->setTooltip("AutoMod");
builder.emplace<BadgeElement>(makeAutoModBadge(),
MessageElementFlag::BadgeChannelAuthority);
// AutoMod "username"
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
MessageColor(QColor("blue")),
@@ -95,10 +101,8 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
builder.message().flags.set(MessageFlag::PubSub);
// AutoMod shield badge
builder
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
MessageElementFlag::BadgeChannelAuthority)
->setTooltip("AutoMod");
builder.emplace<BadgeElement>(makeAutoModBadge(),
MessageElementFlag::BadgeChannelAuthority);
// AutoMod "username"
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
MessageColor(QColor("blue")),