Discord relay: wrap button links in <> so Discord shows no preview cards under every post
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ const queues = new Map(); const seen = new Map();
|
|||||||
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
||||||
function content(text, buttons) {
|
function content(text, buttons) {
|
||||||
let c = htmlToMd(String(text || ''));
|
let c = htmlToMd(String(text || ''));
|
||||||
const links = []; try { for (const row of (buttons && buttons.inline_keyboard) || []) for (const b of row) if (b && b.url) links.push('[' + String(b.text || 'Open').replace(/[\[\]]/g, '') + '](' + b.url + ')'); } catch (e) {}
|
const links = []; try { for (const row of (buttons && buttons.inline_keyboard) || []) for (const b of row) if (b && b.url) links.push('[' + String(b.text || 'Open').replace(/[\[\]]/g, '') + '](<' + b.url + '>)'); } catch (e) {}
|
||||||
if (links.length) c += '\n\n' + links.join(' · ');
|
if (links.length) c += '\n\n' + links.join(' · ');
|
||||||
return c.length > 1990 ? c.slice(0, 1989) + '…' : c;
|
return c.length > 1990 ? c.slice(0, 1989) + '…' : c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user