[AB-xxx] adding avatar to message embed

adding avatar to starboard post
adding possibility to define a color for the starboard container
fixing attachment logic for starboard post
fixing streamer went offline message not using components v2
This commit is contained in:
Sheldan
2025-07-19 23:57:43 +02:00
parent 8bb07ee281
commit 06ef5fc43b
6 changed files with 84 additions and 24 deletions

View File

@@ -1,12 +1,28 @@
{
"components": [
{
"type": "textDisplay",
<#assign userFound=author??>
<#include "user_user_name">
<#assign userText><#if author??><@user_user_name user=author/><#else><@safe_include "delete_user_name"/></#if></#assign>
<#include "member_user_name">
<#assign embeddingUserText><@member_user_name member=embeddingUser/></#assign>
"content": "<@safe_include "message_embed_meta_info"/>"
<#assign userAvatar><#if author??>${author.effectiveAvatarUrl}</#if></#assign>
<#if userFound>
"type": "section",
"components": [
{
"type": "textDisplay",
"content": "<@safe_include "message_embed_meta_info"/>"
}
],
"accessory": {
"type": "thumbnail",
"url": "${userAvatar}"
}
<#else>
"type": "textDisplay",
"content": "<@safe_include "message_embed_meta_info"/>"
</#if>
},
{
"type": "container",

View File

@@ -1,21 +1,40 @@
{
"components": [
{
"type": "textDisplay",
<#assign userFound=author??>
<#assign emote>${starLevelEmote}</#assign>
<#assign count>${starCount}</#assign>
<#assign messageId>${message.messageId?c}</#assign>
<#assign userText><#if author??><#include "user_user_name"><@user_user_name user=author/><#else><@safe_include "delete_user_name"/></#if></#assign>
<#if channel?has_content>
<#assign channelMention>${channel.asMention?json_string}</#assign>
"content": "<@safe_include "starboard_post_embed_additional_message"/>"
<#assign userAvatar><#if author??>${author.effectiveAvatarUrl}</#if></#assign>
<#assign userComponent>
"type": "textDisplay",
<#if channel?has_content>
<#assign channelMention>${channel.asMention?json_string}</#assign>
"content": "<@safe_include "starboard_post_embed_additional_message"/> ${(starCount >= 15)?string('yes', 'no')} ${(starCount >= 15)?string('yes', 'no')} ${(starCount >= 10)?string('yes', 'no')} ${(starCount >= 2)?string('yes', 'no')} ${(starCount >= 1)?string('yes', 'no')}"
<#else>
<#assign channelMention>${sourceChannelId?c}</#assign>
"content": "<@safe_include "starboard_post_embed_additional_message"/>"
</#if>
</#assign>
<#if userFound>
"type": "section",
"components": [
{
${userComponent}
}
],
"accessory": {
"type": "thumbnail",
"url": "${userAvatar}"
}
<#else>
<#assign channelMention>${sourceChannelId?c}</#assign>
"content": "<@safe_include "starboard_post_embed_additional_message"/>"
${userComponent}
</#if>
}
,{
"type": "container",
<#include "starboard_post_container_color">
"components": [
<#assign hasContent=false>
<#if message.content?has_content>
@@ -26,8 +45,15 @@
}
</#if>
<#list message.embeds as embed>
<#if embed.description?has_content>
<#if embed.description?has_content && !((embed.cachedImageInfo?has_content && embed.cachedImageInfo.proxyUrl?has_content) || (embed.cachedThumbnail?has_content && embed.cachedThumbnail.proxyUrl?has_content))>
<#assign hasContent=true>
{
"type": "textDisplay",
"content": "${embed.description?json_string}"
}
<#elseif embed.description?has_content && (embed.cachedImageInfo?has_content && embed.cachedImageInfo.proxyUrl?has_content && embed.cachedImageInfo.width gt 0)
|| (embed.cachedThumbnail?has_content && embed.cachedThumbnail.proxyUrl?has_content && embed.cachedThumbnail.width gt 0)>
<#assign hasContent=true>
,{
"type": "section",
"components": [
@@ -36,12 +62,10 @@
"content": "${embed.description?json_string}"
}
]
<#if (embed.cachedImageInfo?has_content && embed.cachedImageInfo.proxyUrl?has_content) || (embed.cachedThumbnail?has_content && embed.cachedThumbnail.proxyUrl?has_content)>
,"accessory": {
"type": "thumbnail",
"url": "${(embed.cachedImageInfo.proxyUrl)!embed.cachedThumbnail.proxyUrl}"
}
</#if>
}
<#elseif (embed.cachedImageInfo?has_content && embed.cachedImageInfo.proxyUrl?has_content && embed.cachedImageInfo.width gt 0)
|| (embed.cachedThumbnail?has_content && embed.cachedThumbnail.proxyUrl?has_content && embed.cachedThumbnail.width gt 0)>

View File

@@ -1,18 +1,37 @@
<#include "format_instant">
{
"embeds": [
"components": [
{
<#include "twitch_color">,
<#assign channelName=channelName>
<#assign avatarURL=avatarURL>
"title": {
"title": "<@safe_include "twitch_streamer_went_offline_notification_title"/>"
},
"author": { "name": "${channelName}", "avatar": "${avatarURL}"},
"description": "<@safe_include "twitch_streamer_went_offline_notification_past_sections"/>"
<#if offlineImageURL??>,
<#assign offlineImageURL=offlineImageURL>
"imageUrl": "${offlineImageURL}"</#if>
"type": "section",
"components": [
{
"type": "textDisplay",
"content": "<@safe_include "twitch_streamer_went_offline_notification_title"/>"
},
{
"type": "textDisplay",
"content": "<@safe_include "twitch_streamer_went_offline_notification_past_sections"/>"
}
]
,"accessory": {
"type": "thumbnail",
"url": "${avatarURL}"
}
}
]
<#if offlineImageURL??>,
{
"type": "mediaGallery",
"images": [
{
"url": "${offlineImageURL}"
}
]
}
</#if>
],
"messageConfig": {
"useComponentsV2": true
}
}

View File

@@ -1 +1,2 @@
${emote} ${count} by ${userText} in ${channelMention} ID: ${messageId}
-# ${emote} ${count} by ${userText} in ${channelMention}
-# ID: ${messageId}

View File

@@ -1,4 +1,4 @@
They played:
<#list pastSections as section>
<@format_instant_date_time instant=section.startedAt/> `${section.gameName}` - `${section.title}`
<@format_instant_date_time instant=section.startedAt/> `${section.gameName}` - `${section.title}`
</#list>