Last active
September 3, 2025 12:19
-
-
Save adityaparsad01/1725d7160f14015638715aba8a6ddb01 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 = "By Aditya" | |
| 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