Spaces:
Paused
Paused
Download plugins/fun.js from Asitha2005/asitha2: direct link, hf CLI and curl.
- Browser
- Download file 2.25 kB
-
https://huggingface.co/spaces/Asitha2005/asitha2/resolve/main/plugins/fun.js
- Command line
-
hf download hf://spaces/Asitha2005/asitha2/plugins/fun.js
-
curl -L -o fun.js https://huggingface.co/spaces/Asitha2005/asitha2/resolve/main/plugins/fun.js
2.25 kB
| 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."); | |
| } | |
| }); | |