Fix Discord posts not appearing due to invalid avatar URLs
Ensure user avatar URLs are valid HTTP/HTTPS links before sending to Discord, falling back to a default logo if not. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 53f72850-e9eb-451e-8e0e-affadfc7c37b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/zMxtXds Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
79f76904a5
commit
39c8a2ab86
1 changed files with 5 additions and 1 deletions
|
|
@ -77,7 +77,11 @@ async function sendPostToDiscord(post, authorInfo = null) {
|
|||
}
|
||||
|
||||
const authorName = author?.full_name || author?.username || "AeThex User";
|
||||
const authorAvatar = author?.avatar_url || "https://aethex.dev/logo.png";
|
||||
// Discord only accepts HTTP/HTTPS URLs for icons - filter out base64/data URLs
|
||||
const rawAvatar = author?.avatar_url || "";
|
||||
const authorAvatar = rawAvatar.startsWith("http://") || rawAvatar.startsWith("https://")
|
||||
? rawAvatar
|
||||
: "https://aethex.dev/logo.png";
|
||||
const arm = post.arm_affiliation || "labs";
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
|
|||
Loading…
Reference in a new issue