Spaces:
Paused
Paused
File size: 2,248 Bytes
c5e5945 | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | const axios = require('axios');
const { cmd, commands } = require('../command');
cmd({
pattern: "animegirl",
desc: "Fetch a random anime girl image.",
category: "fun",
react: "π§",
filename: __filename
},
async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => {
try {
const apiUrl = `https://api.waifu.pics/sfw/waifu`;
const response = await axios.get(apiUrl);
const data = response.data;
await conn.sendMessage(from, { image: { url: data.url }, caption: 'π§ *Random Anime Girl Image* π§\n> *POWERED by ASITHA-MD*' }, { quoted: mek });
} catch (e) {
console.log(e);
reply(`Error fetching anime girl image: ${e.message}`);
}
});
cmd({
pattern: "fact",
desc: "π§ Get a random fun fact",
react: "π€",
category: "fun",
filename: __filename
},
async (conn, mek, m, { from, q, reply }) => {
try {
const url = 'https://uselessfacts.jsph.pl/random.json?language=en'; // API for random facts
const response = await axios.get(url);
const fact = response.data.text;
const funFact = `
π§ *Random Fun Fact* π§
${fact}
Isn't that interesting? π
`;
return reply(funFact);
} catch (e) {
console.log(e);
return reply("β οΈ An error occurred while fetching a fun fact. Please try again later.");
}
});
cmd({
pattern: "joke",
desc: "π Get a random joke",
react: "π€£",
category: "fun",
filename: __filename
},
async (conn, mek, m, { from, q, reply }) => {
try {
const url = 'https://official-joke-api.appspot.com/random_joke'; // API for random jokes
const response = await axios.get(url);
const joke = response.data;
const jokeMessage = `
π *Here's a random joke for you!* π
*${joke.setup}*
${joke.punchline} π
> *POWERED by ASITHA-MD*
`;
return reply(jokeMessage);
} catch (e) {
console.log(e);
return reply("β οΈ Couldn't fetch a joke right now. Please try again later.");
}
});
|