-
-
Save kajju027/a23294585daa6bf63700e06b58163076 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { bot, sleep } = require("../lib"); | |
| bot( | |
| { | |
| pattern: "joke ?(.*)", | |
| fromMe: true, | |
| desc: "get a random joke", | |
| type: "all" | |
| }, | |
| async (message) => { | |
| const response = await fetch( | |
| "https://official-joke-api.appspot.com/random_joke" | |
| ); | |
| const json = await response.json(); | |
| if (!json.setup || !json.punchline) | |
| return await message.send( | |
| "Oops, something went wrong fetching the joke." | |
| ); | |
| const creator = "Ꭾᴏᴡᴇʀᴇᴅ Ᏼʏ ꕶᴀʏᴀɴ ᴏᴀɪ 🌐" | |
| const joke = `${json.setup}\n\n${json.punchline}\n\n${creator}`; | |
| return await message.send(joke); | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment