Skip to content

Instantly share code, notes, and snippets.

@ADK-RICHU
Forked from A-d-i-t-h-y-a-n/jokes.js
Last active September 8, 2023 03:27
Show Gist options
  • Select an option

  • Save ADK-RICHU/9093d971432981a2d486b5509e328841 to your computer and use it in GitHub Desktop.

Select an option

Save ADK-RICHU/9093d971432981a2d486b5509e328841 to your computer and use it in GitHub Desktop.
const {
Function,
isPublic,
getJson,
prefix
} = require("../lib/");
Function({
pattern: 'joke ?(.*)',
fromMe: isPublic,
desc: 'Funny jokes',
type: 'fun'
}, async (m, text, client) => {
let imgs = ["https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTrFBYrhQhs_Rdv2vq_6jT-lfJHMJq39sr9Pw&usqp=CAU", "https://i.imgur.com/BfcYBnE.jpeg", "https://i.imgur.com/t8aUdZS.jpeg", "https://i.imgur.com/RWG58nL.jpeg", "https://i.imgur.com/xdvaMaN.jpeg", "https://i.imgur.com/X4wT8Lq.jpeg", "https://i.imgur.com/FIxdk2D.jpeg"]
let image = imgs[Math.floor(Math.random() * imgs.length)]
var {
joke
} = await getJson("https://some-random-api.ml/joke")
const buttons = [{
buttonId: prefix + 'joke',
buttonText: {
displayText: 'Next ➩'
},
type: 1
}]
const buttonMessage = {
image: {
url: image
},
caption: '```' + joke + '```',
footer: '© ᴀᴅᴋ ʀᴉᴄⲏᴜ ᴘᴜʙᴌᴉᴄ ʙᴏᴛ',
buttons: buttons,
headerType: 4
}
await client.sendMessage(m.jid, buttonMessage)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment