/* Nama Fitur: Uno.js * Creator: JoooTzyh * Type: Plugins ESM * Modified for Lulli Bot * Channel: https://whatsapp.com/channel/0029VbCMK1N35fLocOdiz00T */ import c from 'node:crypto'; const UNO_HTML = "\n\n\n\n\nUNO · Rich Game\n\n\n\n
\n
UNO
Warna
\n
\n
\n
\n
\n
AMBIL
\n
KARTU ATAS
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
Ketuk kartu untuk pilih · ketuk kartu terpilih untuk main · ambil kartu dari deck
\n

Pilih jumlah AI

\n

Pilih warna

\n
\n
\n
\n

    Tekan ULANGI untuk bermain lagi.

    \n
    \n
    \n\n\n\n"; export function buildUnoUnifiedResponse({ title = 'UNO · vs AI', html = UNO_HTML, url = '' } = {}) { let trusted = ['example.com']; let sourceUrl = url || 'https://example.com'; try { if (url) { const parsed = new URL(url); trusted = [parsed.origin]; sourceUrl = parsed.href; } } catch {} return { response_id: `uno_${Date.now()}_${c.randomBytes(4).toString('hex')}`, sections: [ { __typename: 'GenAIUnifiedResponseSection', view_model: { __typename: 'GenAISingleLayoutViewModel', primitive: { __typename: 'GenAIBotProgressStatusPrimitive', title, is_in_progress: true } } } ], embedded_screens: [ { title, content: [ { __typename: 'FOAIDNixelButtonSheets', tabs: [ { id: 'tab_0', tab_header: 'UNO', sections: [ { __typename: 'GenAIUnifiedResponseSection', view_model: { __typename: 'GenAISingleLayoutViewModel', primitive: { __typename: 'GenAIaeacdsnwHtmlPrimitive', payload: html, url: sourceUrl, trusted_sources: trusted } } } ] } ] } ], step_entries: [] } ] }; } export async function sendUnoRich(sock, jid, payload) { if (typeof sock?.relayMessage !== 'function') return false; try { const messageId = typeof sock.generateMessageTag === 'function' ? sock.generateMessageTag() : c.randomBytes(8).toString('hex'); await sock.relayMessage( jid, { messageContextInfo: { deviceListMetadata: {}, deviceListMetadataVersion: 2, botMetadata: { messageDisclaimerText: '', richResponseSourcesMetadata: {} } }, botForwardedMessage: { message: { richResponseMessage: { messageType: 1, unifiedResponse: { data: Buffer.from(JSON.stringify(payload)).toString('base64') }, contextInfo: { forwardingScore: 1, isForwarded: true, forwardedAiBotMessageInfo: { botJid: '0@bot' }, forwardOrigin: 4 } } } } }, { messageId } ); return true; } catch { return false; } } export async function runUno(m, sock, context = {}) { const jid = m.chat || m.key?.remoteJid; const payload = buildUnoUnifiedResponse({ url: context.setting?.link || '' }); const ok = await sendUnoRich(sock, jid, payload); if (!ok) { await sock.sendMessage(jid, { text: '🎮 UNO rich tidak tersedia di perangkat ini. Coba klien WhatsApp terbaru.' }, { quoted: m }); } return ok; } export default { run: async (m, sock, context) => runUno(m, sock, context), cmd: ['uno'], type: 'game', use: '.uno', desc: 'Main UNO melawan AI di rich message.', location: 'plugins/uno.js' };