Spaces:
Paused
Paused
File size: 862 Bytes
bb69f9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
const { bot, generateList, getJson } = require('../lib/')
bot(
{
pattern: 'news ?(.*)',
desc: 'malayalam news',
type: 'misc',
},
async (message, match) => {
if (!match) {
const { result } = await getJson('https://levanter.onrender.com/news')
const list = generateList(
result.map(({ title, url, time }) => ({
_id: `π &id\n`,
text: `π${title}${time ? `\nπ${time}` : ''}\n`,
id: `news ${url}`,
})),
'Malayalam News',
message.jid,
message.participant,
message.id
)
return await message.send(list.message, {}, list.type)
}
if (match.startsWith('http')) {
const { result } = await getJson(`https://levanter.onrender.com/news?url=${match}`)
return await message.send(result, { quoted: message.data })
}
}
)
|