Skip to content

Instantly share code, notes, and snippets.

@adityaparsad01
Last active September 3, 2025 12:19
Show Gist options
  • Select an option

  • Save adityaparsad01/1725d7160f14015638715aba8a6ddb01 to your computer and use it in GitHub Desktop.

Select an option

Save adityaparsad01/1725d7160f14015638715aba8a6ddb01 to your computer and use it in GitHub Desktop.
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