𝗗𝗔π—₯π—₯π—˜π—Ÿπ—Ÿ π— π—¨π—–π—›π—˜π—₯π—œ ⚑ commited on
Commit
5d18002
Β·
unverified Β·
1 Parent(s): 49d9aa7

Update tools-fancyfont.js

Browse files
Files changed (1) hide show
  1. 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
- pattern: 'font',
23
- alias: ['fancy', 'font-txt'],
24
- react: '✍️',
25
- desc: 'Convert text into various fonts.', // Description of the command
26
- category: 'tools', // Command category
27
- filename: __filename // Filename for reference
28
- }, async (_conn, _mek, _m, { from, quoted, body, args, q, reply }) => {
29
- try {
30
- // If the user did not provide text, show an error
31
- if (!q) return reply('Please provide text to convert into fonts.');
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
  });