import { asArray, asRecord } from '../api.js'; import type { SixtySClient } from '../client.js'; export default async function (client: SixtySClient) { const data = await client.fetch('/gold-price'); const lines = ['๐Ÿ’ฐ ไปŠๆ—ฅ้‡‘ไปท', '']; if (data.date) lines.push(`๐Ÿ“… ${data.date}`); const metals = asArray(data.metals); if (metals.length > 0) { lines.push(''); metals.forEach((item) => { const row = asRecord(item); const name = row.name || '้ป„้‡‘'; const price = row.today_price || row.sell_price || row.price || 'N/A'; const unit = row.unit || 'ๅ…ƒ/ๅ…‹'; if (price !== 'N/A') lines.push(`${name}: ยฅ${price} ${unit}`); }); } else if (data.price) { lines.push(`ๅฝ“ๅ‰้‡‘ไปท: ยฅ${data.price}/ๅ…‹`); } return lines.join('\n'); }