Advertisement
samiroexpikachu

Toonme

Jul 3rd, 2024
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const axios = require('axios');
  2.  
  3. module.exports = {
  4.   config: {
  5.     name: "toonme",
  6.     version: "1.0",
  7.     author: "Samir ล’",
  8.     countDown: 5,
  9.     role: 0,
  10.     shortDescription: {
  11.       en: "Generate art"
  12.     },
  13.     longDescription: {
  14.       en: "Generate art "
  15.     },
  16.     category: "๐—”๐—œ-๐—š๐—˜๐—ก๐—˜๐—ฅ๐—”๐—ง๐—˜๐——",
  17.     guide: {
  18.       en: `[
  19. 1: cartoon02
  20. 2: Cartoon002
  21. 3: NewCartoon
  22. 4: cartoon-real1
  23. 5: 2d-cartoon
  24. 6: cartoonZ
  25. 7: HD-Face-Cartoon
  26. 8: cartoon01
  27. 9: cartoon-real5
  28. 10: christmas-cartoon
  29. 11: simpson
  30. 12: 2023
  31. 13: simpson2
  32. 14: cartoon-real4
  33. 15: Disney2D
  34. 16: barbie
  35. 17: Disney3D
  36. 18: grungy
  37. 19: sketcher
  38. 20: sketch
  39. 21: magic-cartoon
  40. 22: Photo-Cartoon
  41. 23: sketch02
  42. 24: warm-cartoon
  43. 25: sketching
  44. 26: art-cartoon
  45. 27: toon01
  46. 28: toon02
  47. 29: toon04
  48. 30: toon05
  49. 31: bodycartoon2
  50. 32: bodycartoon1
  51. 33: toon06
  52. 34: toon07
  53. 35: toon03
  54. 36: toonify
  55. 37: toonify2
  56. 38: paintA
  57. 39: paint1
  58. 40: paint-new-a
  59. 41: paint-point-a
  60. 42: toonizarro
  61. 43: licht
  62. 44: toonizarro02
  63. 45: water
  64. 46: rgbdots
  65. 47: colcells
  66. 48: emboss
  67. 49: cristal
  68. 50: vintage
  69. 51: caricature-smile-a
  70. 52: caricature-gro
  71. 53: caricature-troll-a
  72. 54: caricature-fat-a
  73. 55: caricature-alien-a
  74. 56: photolab-dave-hill
  75. 57: photolab-neon
  76. 58: photolab-old-photo
  77. 59: photolab-plumbago
  78. 60: photolab-rain
  79. 61: photolab-sketch
  80. 62: photolab-snow
  81. 63: photolab-underwater
  82. 64: photolab-van-gogh
  83. 65: photolab-vintage
  84. 66: photolab-glamour
  85. 67: photolab-vogue
  86. 68: photolab-pen
  87. 69: photolab-pastel
  88. 70: photolab-graffiti
  89. 71: photolab-dipinto
  90. 72: photolab-pencil
  91. 73: halloween2
  92. 74: halloween1
  93. ]
  94. `
  95.     }
  96.   },
  97.  
  98.   onStart: async function ({ api, args, event }) {
  99.     try {
  100.       const imageLink = event.messageReply?.attachments?.[0]?.url;
  101.  
  102.       if (!imageLink) {
  103.         return api.sendMessage('Please reply to an image.', event.threadID, event.messageID);
  104.       }
  105.  
  106.       try {
  107.         const imgurResponse = await axios.get(`https://samirxpikachu.onrender.com/telegraph?url=${encodeURIComponent(imageLink)}&senderId=${event.senderID}`);
  108.  
  109.         if (!imgurResponse.data.success) {
  110.           const errorMessage = imgurResponse.data.error;
  111.  
  112.           if (errorMessage === 'Limit Exceeded') {
  113.             return api.sendMessage('Limit exceeded, try again after 2 hours.', event.threadID, event.messageID);
  114.           } else if (errorMessage === 'Access Forbidden') {
  115.             return api.sendMessage('You are banned because of trying to change credits. Contact admin: [Admin ID](https://www.facebook.com/samir.oe70)', event.threadID, event.messageID);
  116.           }
  117.         }
  118.  
  119.         const imgur = imgurResponse.data.result.link;
  120.         const filter = args[0];
  121.         const apiUrl = `https://samirxpikachu.onrender.com/cartoon?url=${encodeURIComponent(imgur)}&model=${filter || 5}&apikey=richixsamir`;
  122.         const imageStream = await global.utils.getStreamFromURL(apiUrl);
  123.  
  124.         if (!imageStream) {
  125.           return api.sendMessage('Something happened to Server will be fixed within 48 hours', event.threadID, event.messageID);
  126.         }
  127.  
  128.         return api.sendMessage({ attachment: imageStream }, event.threadID, event.messageID);
  129.       } catch (error) {
  130.         console.error(error);
  131.         return api.sendMessage('Skill issues', event.threadID, event.messageID);
  132.       }
  133.     } catch (error) {
  134.       console.error(error);
  135.       return api.sendMessage('Unknown error', event.threadID, event.messageID);
  136.     }
  137.   }
  138. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement