Spaces:
Paused
Paused
πππ₯π₯πππ π π¨ππππ₯π β‘
commited on
Update tools-fancyfont.js
Browse files- plugins/tools-fancyfont.js +46 -29
plugins/tools-fancyfont.js
CHANGED
|
@@ -19,34 +19,51 @@ const axios = require('axios');
|
|
| 19 |
|
| 20 |
// Register the command
|
| 21 |
cmd({
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
}, async (
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
// Fetch fonts from the API using the provided text
|
| 34 |
-
let response = await axios.get(`https://www.dark-yasiya-api.site/other/font?text=${encodeURIComponent(q)}`);
|
| 35 |
-
let result = response.data;
|
| 36 |
-
|
| 37 |
-
// If the response doesn't have fonts, show an error
|
| 38 |
-
if (!result.result) return reply('Error fetching fonts. Please try again later.');
|
| 39 |
-
|
| 40 |
-
// Format the fonts for display
|
| 41 |
-
let formattedFonts = result.result
|
| 42 |
-
.map(font => `*${font.name}:*\n${font.font}`) // Add font name and its content
|
| 43 |
-
.join('\n\n'); // Join multiple fonts with spacing
|
| 44 |
-
|
| 45 |
-
// Reply with the formatted fonts and credit message
|
| 46 |
-
reply(`*SUBZERO MD FANCY FONTS:*\n\n${formattedFonts}\n\n> *Made By Mr Frank*`);
|
| 47 |
-
} catch (error) {
|
| 48 |
-
// Log and display an error message if something goes wrong
|
| 49 |
-
console.error(error);
|
| 50 |
-
reply('An error occurred while fetching fonts.');
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
});
|
|
|
|
| 19 |
|
| 20 |
// Register the command
|
| 21 |
cmd({
|
| 22 |
+
pattern: "fancy",
|
| 23 |
+
alias: ['font', "style"],
|
| 24 |
+
react: 'βοΈ',
|
| 25 |
+
desc: "Convert text into various fonts.",
|
| 26 |
+
category: "tools",
|
| 27 |
+
filename: __filename
|
| 28 |
+
}, async (conn, mek, m, { from, quoted, body, args, q, reply }) => {
|
| 29 |
+
try {
|
| 30 |
+
if (!q) {
|
| 31 |
+
return reply("Please provide text to convert into fonts. Eg .fancy Mr Frank");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
}
|
| 33 |
+
|
| 34 |
+
let response = await axios.get('https://www.dark-yasiya-api.site/other/font?text=' + encodeURIComponent(q));
|
| 35 |
+
let data = response.data;
|
| 36 |
+
|
| 37 |
+
if (!data.status) {
|
| 38 |
+
return reply("Error fetching fonts. Please try again later.");
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
let fontResults = data.result.map(font => '*' + font.name + ":*\n" + font.result).join("\n\n");
|
| 42 |
+
|
| 43 |
+
// Message formatting
|
| 44 |
+
let message = `*SUBZERO FANCY FONTS*:\n\n${fontResults}\n\n> *BY JAWADTECHX*`;
|
| 45 |
+
|
| 46 |
+
// Sending the message with context info
|
| 47 |
+
await conn.sendMessage(
|
| 48 |
+
from,
|
| 49 |
+
{
|
| 50 |
+
text: message,
|
| 51 |
+
contextInfo: {
|
| 52 |
+
mentionedJid: [m.sender],
|
| 53 |
+
forwardingScore: 999,
|
| 54 |
+
isForwarded: true,
|
| 55 |
+
forwardedNewsletterMessageInfo: {
|
| 56 |
+
newsletterJid: '120363304325601080@newsletter',
|
| 57 |
+
newsletterName: 'Mr Frank OFC',
|
| 58 |
+
serverMessageId: 143
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
{ quoted: mek }
|
| 63 |
+
);
|
| 64 |
+
|
| 65 |
+
} catch (error) {
|
| 66 |
+
console.error(error);
|
| 67 |
+
reply("An error occurred while fetching fonts.");
|
| 68 |
+
}
|
| 69 |
});
|