API-XX commited on
Commit
64b96b5
Β·
verified Β·
1 Parent(s): 2b87d47

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +60 -30
case.js CHANGED
@@ -996,6 +996,8 @@ module.exports = async (conn, dev, chatUpdate, store) => {
996
  > ${sign} ${prefix}qr
997
  > ${sign} ${prefix}script
998
  > ${sign} ${prefix}sticker
 
 
999
  > ─────────────❐
1000
 
1001
  > β”€γ€Ž \`𝐒𝐄𝐀𝐑𝐂𝐇 πŒπ„ππ”\` 』
@@ -3695,39 +3697,67 @@ case 'mediafire': {
3695
  }
3696
  break;
3697
  }
3698
- case 's':
3699
- case 'sticker':
3700
- case 'stiker': {
3701
- await loading();
3702
- if (isImage || isViewOnce || isQuotedImage || isVideo || isQuotedVideo) {
3703
- if (quoted.seconds > 10) return reply("Videos must be 10 seconds or shorter!");
3704
- let quality = isImage ? 70 : 2;
3705
- let { Sticker, createSticker, StickerTypes } = require('wa-sticker-formatter');
3706
- let media = await conn.downloadAndSaveMediaMessage(quoted, makeid(5));
3707
- // Create the sticker
3708
- let sticker = new Sticker(media, {
3709
- pack: fontx('blue demon'),
3710
- author: font('πŸ‘€'),
3711
- type: StickerTypes.FULL,
3712
- categories: ['🀩', 'πŸŽ‰'], // Sticker categories
3713
- id: '12345',
3714
- quality: quality,
3715
- background: '#FFFFFF00'.
3716
- });
3717
- let outputFile = getRandom(".webp");
3718
- let filePath = await sticker.toFile(outputFile);
3719
- let stickerBuffer = fs.readFileSync(filePath);
3720
- await conn.sendMessage(from, { sticker: stickerBuffer }, { quoted: m });
3721
- await fs.unlinkSync(outputFile);
3722
- await fs.unlinkSync(media);
3723
- } else {
3724
- reply(`Please send an image or video with the caption '${command}', or reply to an image or video!\nNote: Videos must be 10 seconds or shorter.`);
3725
- }
3726
- break;
3727
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3728
 
 
 
 
 
 
3729
 
 
 
 
3730
 
 
 
 
 
 
 
3731
 
3732
 
3733
 
 
996
  > ${sign} ${prefix}qr
997
  > ${sign} ${prefix}script
998
  > ${sign} ${prefix}sticker
999
+ > ${sign} ${prefix}getjid
1000
+ > ${sign} ${prefix}fancy
1001
  > ─────────────❐
1002
 
1003
  > β”€γ€Ž \`𝐒𝐄𝐀𝐑𝐂𝐇 πŒπ„ππ”\` 』
 
3697
  }
3698
  break;
3699
  }
3700
+ case 's':
3701
+ case 'sticker':
3702
+ case 'take': {
3703
+ if (!m.quoted) {
3704
+ return reeply(`*Reply to an image or video with the caption ${prefix + command}*\n> Video Duration: 1-9 Seconds`);
3705
+ }
3706
+ let mime = (m.quoted.msg || m.quoted).mimetype || '';
3707
+ try {
3708
+ if (/image/.test(mime)) {
3709
+ let media = await m.quoted.download();
3710
+ await conn.sendImageAsSticker(m.chat, media, m, {
3711
+ packname: fontx(caption) || 'Sticker Pack',
3712
+ author: fontx('blue demon') || 'Bot'
3713
+ });
3714
+ } else if (/video/.test(mime)) {
3715
+ if ((m.quoted.msg || m.quoted).seconds > 9) {
3716
+ return reply(`*Video duration must be 1-9 seconds!*\nReply to a shorter video with ${prefix + command}`);
3717
+ }
3718
+ let media = await m.quoted.download();
3719
+ await conn.sendVideoAsSticker(m.chat, media, m, {
3720
+ packname: fontx(caption) || 'Sticker Pack',
3721
+ author: fontx('blue demon') || 'Bot'
3722
+ });
3723
+ } else {
3724
+ reply(`*Unsupported media type!*\nReply to an image or video with the caption ${prefix + command}\n> Video Duration: 1-9 Seconds`);
3725
+ }
3726
+ } catch (err) {
3727
+ console.error('Error creating sticker:', err);
3728
+ reply(`Failed to create sticker. Please try again.`);
3729
+ }
3730
+ }
3731
+ break;
3732
+ case 'getjid': {
3733
+ reply(from)
3734
+ }
3735
+ case 'fancy': {
3736
+ if (!q) return reply("❌ Please provide a text to convert.\n\nExample: *!fancy Blue Demon*");
3737
+
3738
+ await loading();
3739
+ let apiUrl = `https://api-xx-xi.hf.space/api/font?text=${encodeURIComponent(q)}`;
3740
+
3741
+ try {
3742
+ let response = await fetch(apiUrl);
3743
+ let json = await response.json();
3744
 
3745
+ if (!json.success || !json.fancy_texts.length) {
3746
+ return reply("❌ Failed to fetch fancy fonts. Please try again.");
3747
+ }
3748
+
3749
+ let fancyTextList = json.fancy_texts.slice(0, 15).map((text, i) => `${i + 1}. *${text}*`).join("\n");
3750
 
3751
+ conn.sendMessage(m.chat, {
3752
+ text: fontx(`🎨 *Fancy Text Generator*\n\nπŸ“ *Original:* ${json.original_text}\n\n${fancyTextList}\n\nπŸ“Œ Reply with a number to copy a style!`),
3753
+ }, { quoted: m });
3754
 
3755
+ } catch (error) {
3756
+ console.error("Error fetching fancy fonts:", error);
3757
+ reply("❌ An error occurred while generating fancy text. Please try again later.");
3758
+ }
3759
+ break;
3760
+ }
3761
 
3762
 
3763