mirror of
https://github.com/Sheldan/abstracto-templates.git
synced 2026-04-14 03:46:00 +00:00
[AB-xxx] refactoring some embeds to use components v2
This commit is contained in:
@@ -1,70 +1,121 @@
|
|||||||
{
|
{
|
||||||
"embeds": [
|
"components": [
|
||||||
{
|
{
|
||||||
<#if author??>
|
"type": "textDisplay",
|
||||||
<#include "user_author">
|
<#include "user_user_name">
|
||||||
<@user_author user=author/>
|
<#assign userText><#if author??><@user_user_name user=author/><#else><@safe_include "delete_user_name"/></#if></#assign>
|
||||||
<#else>
|
<#include "member_user_name">
|
||||||
<#include "deleted_user_author"/>
|
<#assign embeddingUserText><@member_user_name member=embeddingUser/></#assign>
|
||||||
</#if>,
|
"content": "<@safe_include "message_embed_meta_info"/>"
|
||||||
<#include "abstracto_color">,
|
},
|
||||||
<#if embeddedMessage.content?has_content || embeddedMessage.embeds?size gt 0>
|
{
|
||||||
"description": "${embeddedMessage.content?json_string}
|
"type": "container",
|
||||||
<#list embeddedMessage.embeds>
|
"components": [
|
||||||
<@safe_include "message_embed_embed_embeds_name"/>:
|
<#assign hasContent=false>
|
||||||
<#items as embed><#assign embed=embed/>
|
<#if embeddedMessage.content?has_content>
|
||||||
<@safe_include "message_embed_embed_description"/>: <#if embed.description?has_content >${embed.description?json_string}</#if> <#if embed.imageUrl?has_content> <@safe_include "message_embed_embed_image_url"/>: ${embed.imageUrl} </#if>
|
<#assign hasContent=true>
|
||||||
</#items>
|
|
||||||
</#list>
|
|
||||||
",
|
|
||||||
</#if>
|
|
||||||
<#if embeddedMessage.attachments?size gt 0 && !embeddedMessage.attachments[0].spoiler>
|
|
||||||
"imageUrl": "${embeddedMessage.attachments[0].proxyUrl}",
|
|
||||||
<#elseif embeddedMessage.attachments?size = 0 && embeddedMessage.embeds?size gt 0 && embeddedMessage.embeds[0].cachedThumbnail??>
|
|
||||||
"imageUrl": "${embeddedMessage.embeds[0].cachedThumbnail.proxyUrl}",
|
|
||||||
<#elseif embeddedMessage.attachments?size = 0 && embeddedMessage.embeds?size gt 0 && embeddedMessage.embeds[0].cachedImageInfo??>
|
|
||||||
"imageUrl": "${embeddedMessage.embeds[0].cachedImageInfo.proxyUrl}",
|
|
||||||
</#if>
|
|
||||||
"fields": [
|
|
||||||
{
|
{
|
||||||
"name": "<@safe_include "message_embed_embed_quoted_by_field_title"/>",
|
"type": "textDisplay",
|
||||||
<#assign user>${embeddingUser.asMention?json_string}</#assign>
|
"content": "${embeddedMessage.content?json_string}"
|
||||||
<#assign channelName>${sourceChannel.name?json_string}</#assign>
|
|
||||||
<#assign messageLink>${embeddedMessage.messageUrl}</#assign>
|
|
||||||
"value": "<@safe_include "message_embed_embed_quoted_by_field_value"/>"
|
|
||||||
}
|
}
|
||||||
<#if embeddedMessage.referencedMessage??>
|
</#if>
|
||||||
,
|
<#list embeddedMessage.embeds as embed>
|
||||||
|
<#if embed.description?has_content>
|
||||||
|
,{
|
||||||
|
<#assign hasContent=true>
|
||||||
|
"type": "section",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"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)>
|
||||||
|
<#assign hasContent=true>
|
||||||
{
|
{
|
||||||
<#assign referencedMessageLink=embeddedMessage.referencedMessage.messageUrl/>
|
"type": "mediaGallery",
|
||||||
<#assign repliedToAuthorMention>${r"<@"}${embeddedMessage.referencedMessage.author.authorId?c}${r">"}</#assign>
|
"images": [
|
||||||
"name": "<@safe_include "message_embed_embed_referenced_message_field_title"/>",
|
{
|
||||||
"value": "<@safe_include "message_embed_embed_referenced_message_field_value"/>"
|
"url": "${(embed.cachedImageInfo.proxyUrl)!embed.cachedThumbnail.proxyUrl}"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
</#if>
|
</#if>
|
||||||
],
|
</#list>
|
||||||
"timeStamp": "${embeddedMessage.timeCreated}"
|
<#if embeddedMessage.attachments?size gt 0>
|
||||||
}
|
<#list embeddedMessage.attachments?filter(x -> x.width gt 0)>
|
||||||
]
|
,{
|
||||||
<#if useButton>
|
<#assign hasContent=true>
|
||||||
,"buttons": [
|
"type": "mediaGallery",
|
||||||
{
|
"images": [
|
||||||
"label": "<@safe_include "message_embed_button_delete"/>",
|
<#items as attachment>
|
||||||
"id": "${buttonConfigModel.buttonId}",
|
{
|
||||||
"buttonStyle": "danger",
|
"url": "${attachment.proxyUrl}"
|
||||||
"metaConfig": {
|
}</#items>
|
||||||
"persistCallback": false
|
]
|
||||||
|
}<#sep>,</#list>
|
||||||
|
</#if>
|
||||||
|
<#if hasContent==false>
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"content": "<@safe_include "message_embed_no_content"/>"
|
||||||
}
|
}
|
||||||
|
</#if>
|
||||||
|
]
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"type": "actionRow",
|
||||||
|
"actionRowItems": [
|
||||||
|
{
|
||||||
|
<#assign channelName>${sourceChannel.name?json_string}</#assign>
|
||||||
|
<#assign messageLink>${embeddedMessage.messageUrl}</#assign>
|
||||||
|
"type": "button",
|
||||||
|
"label": "<#include "message_embed_original_button_label">",
|
||||||
|
"url": "${messageLink}",
|
||||||
|
"buttonStyle": "link"
|
||||||
|
}
|
||||||
|
<#if useButton>
|
||||||
|
,{
|
||||||
|
"label": "<@safe_include "message_embed_button_delete"/>",
|
||||||
|
"id": "${buttonConfigModel.buttonId}",
|
||||||
|
"buttonStyle": "danger",
|
||||||
|
"type": "button",
|
||||||
|
"metaConfig": {
|
||||||
|
"persistCallback": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
<#if embeddedMessage.referencedMessage??>
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
<#assign referencedMessageLink=embeddedMessage.referencedMessage.messageUrl/>
|
||||||
|
"label": "<#include "message_embed_referenced_button_label">",
|
||||||
|
"url": "${referencedMessageLink}",
|
||||||
|
"buttonStyle": "link"
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
</#if>
|
|
||||||
<#if embeddedMessage.attachments?size gt 0 && embeddedMessage.attachments[0].spoiler>
|
|
||||||
,"additionalMessage": "||${embeddedMessage.attachments[0].proxyUrl?json_string}||"
|
|
||||||
</#if>
|
|
||||||
<#if referencedMessageId?has_content && mentionsReferencedMessage?has_content>
|
<#if referencedMessageId?has_content && mentionsReferencedMessage?has_content>
|
||||||
,"referencedMessageId": "${referencedMessageId?c}",
|
,"referencedMessageId": "${referencedMessageId?c}"
|
||||||
"messageConfig": {
|
|
||||||
"mentionsReferencedMessage": ${mentionsReferencedMessage?string('true', 'false')}
|
|
||||||
}
|
|
||||||
</#if>
|
</#if>
|
||||||
|
,"messageConfig": {
|
||||||
|
"allowsUserMention": false,
|
||||||
|
"allowsRoleMention": false,
|
||||||
|
"allowsEveryoneMention": false,
|
||||||
|
"useComponentsV2": true
|
||||||
|
<#if referencedMessageId?has_content && mentionsReferencedMessage?has_content>
|
||||||
|
,"mentionsReferencedMessage": ${mentionsReferencedMessage?string('true', 'false')}
|
||||||
|
</#if>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,51 +1,96 @@
|
|||||||
{
|
{
|
||||||
"embeds": [
|
"components": [
|
||||||
{
|
{
|
||||||
<#if author??>
|
"type": "textDisplay",
|
||||||
<#include "user_author">
|
<#assign emote>${starLevelEmote}</#assign>
|
||||||
<@user_author user=author/>
|
<#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"/>"
|
||||||
<#else>
|
<#else>
|
||||||
<@safe_include "deleted_user_author"/>
|
<#assign channelMention>${sourceChannelId?c}</#assign>
|
||||||
</#if>,
|
"content": "<@safe_include "starboard_post_embed_additional_message"/>"
|
||||||
<#include "abstracto_color">,
|
|
||||||
<#if message.content?has_content || message.embeds?size gt 0>
|
|
||||||
"description": "${message.content?json_string}
|
|
||||||
<#list message.embeds>
|
|
||||||
<@safe_include "starboard_post_embed_embeds_name"/>:
|
|
||||||
<#items as embed>
|
|
||||||
<#if embed.description??> <@safe_include "starboard_post_embed_description"/>: ${embed.description?json_string} </#if> <#if embed.imageUrl?has_content> <@safe_include "starboard_post_embed_image_url"/>: ${embed.imageUrl} </#if>
|
|
||||||
</#items>
|
|
||||||
</#list>
|
|
||||||
",
|
|
||||||
</#if>
|
</#if>
|
||||||
<#if message.attachments?size gt 0>
|
}
|
||||||
"imageUrl": "${message.attachments[0].proxyUrl}",
|
,{
|
||||||
<#elseif message.attachments?size = 0 && message.embeds?size gt 0 && message.embeds[0].cachedThumbnail??>
|
"type": "container",
|
||||||
"imageUrl": "${message.embeds[0].cachedThumbnail.proxyUrl}",
|
"components": [
|
||||||
<#elseif message.attachments?size = 0 && message.embeds?size gt 0 && message.embeds[0].cachedImageInfo??>
|
<#assign hasContent=false>
|
||||||
"imageUrl": "${message.embeds[0].cachedImageInfo.proxyUrl}",
|
<#if message.content?has_content>
|
||||||
</#if>
|
<#assign hasContent=true>
|
||||||
"fields": [
|
|
||||||
{
|
{
|
||||||
"name": "<@safe_include "starboard_post_embed_original_field_title"/>"
|
"type": "textDisplay",
|
||||||
<#if channel?has_content>
|
"content": "${message.content?json_string}"
|
||||||
,"value": "[${channel.name?json_string}](${message.messageUrl})"
|
|
||||||
<#else>
|
|
||||||
,"value": "[${sourceChannelId?c}](${message.messageUrl})"
|
|
||||||
</#if>
|
|
||||||
}
|
}
|
||||||
],
|
</#if>
|
||||||
"timeStamp": "${message.timeCreated}"
|
<#list message.embeds as embed>
|
||||||
|
<#if embed.description?has_content>
|
||||||
|
<#assign hasContent=true>
|
||||||
|
,{
|
||||||
|
"type": "section",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"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)>
|
||||||
|
<#assign hasContent=true>
|
||||||
|
{
|
||||||
|
"type": "mediaGallery",
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"url": "${(embed.cachedImageInfo.proxyUrl)!embed.cachedThumbnail.proxyUrl}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
<#if message.attachments?size gt 0>
|
||||||
|
<#list message.attachments?filter(x -> x.width gt 0)>
|
||||||
|
<#assign hasContent=true>
|
||||||
|
,{
|
||||||
|
"type": "mediaGallery",
|
||||||
|
"images": [
|
||||||
|
<#items as attachment>
|
||||||
|
{
|
||||||
|
"url": "${attachment.proxyUrl}"
|
||||||
|
}</#items>
|
||||||
|
]
|
||||||
|
}<#sep>,</#list>
|
||||||
|
</#if>
|
||||||
|
<#if hasContent==false>
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"content": "<@safe_include "starboard_post_embed_no_content"/>"
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionRow",
|
||||||
|
"actionRowItems": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"label": "<#include "starboard_post_embed_go_to_post_title">",
|
||||||
|
"url": "${message.messageUrl}",
|
||||||
|
"buttonStyle": "link"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
<#assign emote>${starLevelEmote}</#assign>
|
"messageConfig": {
|
||||||
<#assign count>${starCount}</#assign>
|
"allowsUserMention": false,
|
||||||
<#assign messageId>${message.messageId?c}</#assign>
|
"useComponentsV2": true
|
||||||
<#if channel?has_content>
|
}
|
||||||
<#assign channelMention>${channel.asMention?json_string}</#assign>
|
|
||||||
"additionalMessage": "<@safe_include "starboard_post_embed_additional_message"/>"
|
|
||||||
<#else>
|
|
||||||
<#assign channelMention>${sourceChannelId?c}</#assign>
|
|
||||||
"additionalMessage": "<@safe_include "starboard_post_embed_additional_message"/>"
|
|
||||||
</#if>
|
|
||||||
}
|
}
|
||||||
@@ -6,29 +6,59 @@
|
|||||||
<#assign title=currentSection.title>
|
<#assign title=currentSection.title>
|
||||||
<#assign thumbnail=currentSection.thumbnailURL>
|
<#assign thumbnail=currentSection.thumbnailURL>
|
||||||
<#assign viewerCount=currentSection.viewerCount>
|
<#assign viewerCount=currentSection.viewerCount>
|
||||||
"additionalMessage": "<@safe_include "twitch_streamer_go_live_notification_text"/>",
|
"components": [
|
||||||
"embeds": [
|
<#assign additionalText><@safe_include "twitch_streamer_go_live_notification_text"/></#assign>
|
||||||
{
|
<#if additionalText?has_content>
|
||||||
<#include "twitch_color">,
|
{
|
||||||
"author": { "name": "${channelName}", "avatar": "${streamerAvatarURL}", "url": "${streamURL}"},
|
"type": "textDisplay",
|
||||||
"title": {
|
"content": "${additionalText}"
|
||||||
"title": "${title?json_string}"
|
|
||||||
},
|
},
|
||||||
"description": "<@safe_include "twitch_streamer_go_live_notification_current_section"/> <#if pastSections?? && pastSections?size gt 0><@safe_include "twitch_streamer_go_live_notification_past_sections"/></#if>",
|
</#if>
|
||||||
"imageUrl": "${thumbnail}?${randomString}"
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"content": "# ${title?json_string}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"content": "<@safe_include "twitch_streamer_go_live_notification_current_section"/>"
|
||||||
|
}
|
||||||
|
<#if pastSections?? && pastSections?size gt 0>,
|
||||||
|
{
|
||||||
|
"type": "textDisplay",
|
||||||
|
"content": "<@safe_include "twitch_streamer_go_live_notification_past_sections"/>"
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
]
|
||||||
|
,"accessory": {
|
||||||
|
"type": "thumbnail",
|
||||||
|
"url": "${streamerAvatarURL}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mediaGallery",
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"url": "${thumbnail}?${randomString}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionRow",
|
||||||
|
"actionRowItems": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"label": "<@safe_include "twitch_streamer_go_live_notification_watch_button"/>",
|
||||||
|
"url": "${streamURL?json_string}",
|
||||||
|
"buttonStyle": "link"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"messageConfig": {
|
"messageConfig": {
|
||||||
"allowsRoleMention": true
|
"allowsRoleMention": true,
|
||||||
},
|
"useComponentsV2": true
|
||||||
"buttons": [
|
}
|
||||||
{
|
|
||||||
"label": "<@safe_include "twitch_streamer_go_live_notification_watch_button"/>",
|
|
||||||
"url": "${streamURL?json_string}",
|
|
||||||
"buttonStyle": "link",
|
|
||||||
"metaConfig": {
|
|
||||||
"persistCallback": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
Description
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Embeds
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Image URL
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Quoted by
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
${user} from [${channelName} (original)](${messageLink})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Replied to
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[message](${referencedMessageLink}) by ${repliedToAuthorMention}
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
${userText} quoted by ${embeddingUserText}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Go to original in ${channelName}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Referenced message
|
||||||
@@ -1 +1 @@
|
|||||||
${emote} ${count} ${channelMention} ID: ${messageId}
|
${emote} ${count} by ${userText} in ${channelMention} ID: ${messageId}
|
||||||
@@ -1 +0,0 @@
|
|||||||
Description
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Embeds
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Go to message
|
||||||
@@ -1 +0,0 @@
|
|||||||
ImageURL
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
No content found
|
||||||
@@ -1 +0,0 @@
|
|||||||
Original
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
They played:
|
They played:
|
||||||
<#list pastSections as section>
|
<#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>
|
</#list>
|
||||||
Reference in New Issue
Block a user