Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require('axios');
- const fontMap = {
- ' ': ' ',
- 'a': 'π', 'b': 'π', 'c': 'π', 'd': 'π', 'e': 'π', 'f': 'π', 'g': 'π', 'h': 'π',
- 'i': 'π', 'j': 'π', 'k': 'π', 'l': 'π', 'm': 'π', 'n': 'π', 'o': 'π', 'p': 'π', 'q': 'π',
- 'r': 'π', 's': 'π', 't': 'π', 'u': 'π', 'v': 'π', 'w': 'π ', 'x': 'π‘', 'y': 'π’', 'z': 'π£',
- 'A': 'π°', 'B': 'π±', 'C': 'π²', 'D': 'π³', 'E': 'π΄', 'F': 'π΅', 'G': 'πΆ', 'H': 'π·',
- 'I': 'πΈ', 'J': 'πΉ', 'K': 'πΊ', 'L': 'π»', 'M': 'πΌ', 'N': 'π½', 'O': 'πΎ', 'P': 'πΏ', 'Q': 'π',
- 'R': 'π', 'S': 'π', 'T': 'π', 'U': 'π', 'V': 'π ', 'W': 'π', 'X': 'π', 'Y': 'π', 'Z': 'π',
- };
- function convertToFont(text) {
- let convertedText = '';
- for (let char of text) {
- convertedText += fontMap[char] || char;
- }
- return convertedText;
- }
- module.exports = {
- config: {
- name: "magev2",
- aliases: ["vexa"],
- version: "1.0",
- author: "Samir Ε",
- countDown: 5,
- role: 0,
- description: "anime image generator",
- category: "ππ-πππ‘ππ₯ππ§ππ",
- guide: {
- en: `ππππ»π΄π\nβββββββββββββββββββ\nNone
- Professional
- Anime
- Ghibli
- Photographic
- Digital Art
- Comic Book
- Fantasy Art
- Analog Film
- Neonpunk
- Isometric
- Lowpoly
- Origami
- Line Art
- Craft Clay
- Cinematic
- 3D Model
- Pixel Art
- Texture`
- }
- },
- onStart: async function ({ event, api, args }) {
- let prompt = args.join(" ") || "cute girl ";
- let aspectRatio = "1:1";
- let style = 1;
- let presets = 3;
- const design = convertToFont(prompt)
- const inputSentence = `${encodeURIComponent(prompt)}`;
- args.forEach((arg, index) => {
- switch (arg) {
- case '--ar':
- aspectRatio = args[index + 1];
- break;
- case '--style':
- style = parseInt(args[index + 1]);
- break;
- case '--presets':
- presets = parseInt(args[index + 1]);
- break;
- }
- });
- const startTime = Date.now();
- const processingMessage = await api.sendMessage("πΏπππππππππ ππππ πππππππ... πΏπππππ π πππ...β³", event.threadID);
- try {
- const apiUrl = `https://samirxpikachu.onrender.com/mageV2?prompt=${encodeURIComponent(inputSentence)}&style=${encodeURIComponent(style)}&aspect_ratio=${encodeURIComponent(aspectRatio)}`;
- const imgurResponse = await axios.get(`${global.api.samirApi}/telegraph?url=${encodeURIComponent(apiUrl)}&senderId=${event.senderID}`);
- if (!imgurResponse.data.success) {
- const errorMessage = imgurResponse.data.error;
- if (errorMessage === 'Limit Exceeded') {
- return api.sendMessage('π»ππππ ππ‘ππππππ, πππ’ πππππ πππππ 2 πππππ', event.threadID, event.messageID);
- } else if (errorMessage === 'Access Forbidden') {
- return api.sendMessage('πππ πππ ππππππ ππ’ πππππ Ε', event.threadID, event.messageID);
- }
- }
- const imgurLink = imgurResponse.data.result.link;
- const url = await global.utils.uploadImgbb(imgurLink);
- const pattern1 = /-\d+/;
- const pattern2 = /-\d+?-n-png-stp-dst-png-p\d+x\d+-nc-cat-\d+-ccb-\d+-\d+-nc-sid/;
- const filteredUrl = url.image.url.replace(pattern1, "").replace(pattern2, "");
- ;
- const endTime = Date.now();
- const duration = (endTime - startTime) / 1000;
- await api.sendMessage({
- body: `β πΏπππππ: ${design}\n\nβ¨ π»πππ: ${filteredUrl}\n\nβ° πΈππππ πππππππππ ππ ${duration} πππππππ β³ `,
- attachment: await global.utils.getStreamFromURL(imgurLink)
- }, event.threadID);
- } catch (error) {
- console.error(error);
- await api.sendMessage("π΅πππππ ππ ππππππππ πππππ.", event.threadID);
- } finally {
- await api.unsendMessage(processingMessage.messageID);
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement