feat(platform): embed.clear span and resolve/gossip metadata (v0.8.520)
Add embed.clear on message delete and activeChannelId/messageId on embed spans. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -8676,8 +8676,10 @@ class PearcordPlatform extends EventEmitter {
|
||||
gossipSpan.end({
|
||||
spanKind: 'embed.gossip',
|
||||
resolved: true,
|
||||
messageId: msg.id,
|
||||
guildId,
|
||||
channelId,
|
||||
activeChannelId: this.activeChannelId,
|
||||
urlHost: (() => {
|
||||
try {
|
||||
return new URL(url).host
|
||||
@@ -8698,8 +8700,10 @@ class PearcordPlatform extends EventEmitter {
|
||||
spanKind: 'embed.resolve',
|
||||
resolved: !!row,
|
||||
fromCache,
|
||||
messageId: msg.id,
|
||||
guildId,
|
||||
channelId,
|
||||
activeChannelId: this.activeChannelId,
|
||||
urlHost,
|
||||
urlLen: url.length,
|
||||
hasTitle: !!(row?.title),
|
||||
@@ -12934,6 +12938,37 @@ class PearcordPlatform extends EventEmitter {
|
||||
}
|
||||
let clearedReactionCount = 0
|
||||
let unlinkedAttachmentCount = 0
|
||||
let embedClearCount = 0
|
||||
const plainForEmbed = this._messagePlaintext(existing)
|
||||
if (plainForEmbed && this.embeds?.clearForMessageContent) {
|
||||
const embedClearSpan = this.log.time('embed.clear', {
|
||||
spanKind: 'embed.clear',
|
||||
messageId,
|
||||
guildId,
|
||||
channelId
|
||||
})
|
||||
try {
|
||||
const embedClear = await this.embeds.clearForMessageContent(plainForEmbed)
|
||||
embedClearCount = embedClear.clearedCount || 0
|
||||
embedClearSpan.end({
|
||||
spanKind: 'embed.clear',
|
||||
messageId,
|
||||
guildId,
|
||||
channelId,
|
||||
clearedCount: embedClearCount,
|
||||
hadUrl: !!embedClear.hadUrl,
|
||||
activeChannelId: this.activeChannelId
|
||||
})
|
||||
} catch (err) {
|
||||
this.log.error('embed.clear error', {
|
||||
messageId,
|
||||
guildId,
|
||||
channelId,
|
||||
error: err?.message || String(err)
|
||||
})
|
||||
embedClearSpan.fail(err)
|
||||
}
|
||||
}
|
||||
if (this.messages?.clearReactionsForMessage && reactionCount > 0) {
|
||||
const clearSpan = this.log.time('reaction.clear', {
|
||||
spanKind: 'reaction.clear',
|
||||
@@ -13007,6 +13042,7 @@ class PearcordPlatform extends EventEmitter {
|
||||
unlinkedAttachmentCount,
|
||||
hadReactions: reactionCount > 0,
|
||||
reactionCount,
|
||||
embedClearCount,
|
||||
wasOwn: existing?.authorId === this.identity?.user?.id,
|
||||
meshFanout: !!(this.guild || this.dm),
|
||||
activeChannelId: this.activeChannelId
|
||||
|
||||
Reference in New Issue
Block a user