Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions supabase/functions/shared/discordNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ async function sendDiscordNotificationInternal(supabase: any, data: DiscordNotif
if (data.comment?.id) {
notificationId = data.comment.id
} else {
const { data: newNotification } = await supabase
const result = await supabase
.from('discord_notifications')
.insert({
notification_type: data.type,
Expand All @@ -466,6 +466,7 @@ async function sendDiscordNotificationInternal(supabase: any, data: DiscordNotif
.select('id')
.single()

const newNotification = result.data
if (newNotification) {
notificationId = newNotification.id
}
Expand Down Expand Up @@ -658,13 +659,13 @@ function createComponentsV2Message(data: DiscordNotificationData): any[] {
'SYSTEM': 0x808080 // Gray
}

const categoryEmojis: {
const categoryEmojis = {
'COMMENT': '🟢 COMMENT EVENTS',
'REPORT': '🚨 REPORT EVENTS',
'USER MODERATION': '🔨 USER MODERATION EVENTS',
'VOTE': '👍 VOTE EVENTS',
'ANNOUNCEMENT': '📢 ANNOUNCEMENT',
'SYSTEM': '📢 SYSTEM',
'SYSTEM': '📢 SYSTEM'
}

components.push(buildSeparator(true, 2))
Expand Down Expand Up @@ -957,27 +958,28 @@ ${muteCommentSection}
break

case 'user_banned':
accentColor = 0x8B0000 // Dark Red
const banHasCommentInfo = commentId && commentContent
const banCommentSection = banHasCommentInfo ?
`💬 **Related Comment ID:** ${commentId}
accentColor = 0x8B0000 // Dark Red
const banHasCommentInfo = commentId && commentContent
const banCommentSection = banHasCommentInfo ?
`💬 **Related Comment ID:** ${commentId}
📺 **Media:** ${mediaTitle} (${mediaType})

📝 **Comment:**
› ${commentContent}
` : `👤 **Target User:** ${authorName} (ID: ${authorId})`

content = `⛔ **User Banned**
content = `⛔ **User Banned**

👮 **Actor:** ${moderatorName} (ID: ${moderatorId})
👤 **Target User:** ${authorName} (ID: ${authorId})

${banCommentSection}

⏱ **Duration:** ${duration}

📄 **Reason:**
› ${reason}`
break
break

case 'user_unbanned':
accentColor = 0x32CD32 // Lime Green
Expand Down