Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-mini-2024-07-18· OpenAIAi2 WildChat-4.8M (AI2)

Organize este código: console.error("Erro ao roubar sticker:", err); reply(❎ Erro, tente…

  1. User

    Organize este código:

        console.error("Erro ao roubar sticker:", err);
        reply(`❎ Erro, tente mais tarde.`);
    }
    break;
    

    */

    case 'rename': case 'roubar': try { if (!isQuotedSticker) return reply('Marque uma figurinha...'); var kls = q; var pack = kls.split("/")[0]; var author2 = kls.split("/")[1]; if (!q) return reply('Falta um nome para renomear a figurinha... ;-;'); if (!pack) return reply(*Necessita de um nome antes da barra ( / ), ex:*\n${prefix + command} ${pushname + q}); if (!author2) return reply(*Falta um complemento, ex:*\n${prefix + command} ${q}/complemento); (async function renameContextSticker(pack, autor, txt = ``, hehe) { try { const getfile = await getFileBuffer(info.message.extendedTextMessage.contextInfo.quotedMessage.stickerMessage, 'sticker'); const _sticker = new Sticker(); _sticker.addFile(getfile); _sticker.options.metadata = { pack: pack, author: autor, emojis: ['🤠', '🥶', '😻'] }; const resultadoSt = await _sticker.start(); await client.sendMessage(from, { sticker: fs.readFileSync(resultadoSt[0].value), contextInfo: { externalAdReply: { title: txt, body: "", previewType: "PHOTO", thumbnail: fs.readFileSync(resultadoSt[0].value), }, }, }, { quoted: hehe }); await fs.unlinkSync(resultadoSt[0].value); } catch (e) { console.log(e); reply(❌ Erro, tenta mais tarde); } })(pack, author2, ${pack}|${author2}, info); } catch (err) { reply(❌ Erro, tenta mais tarde); console.log(err); } break;

    case 'togif': if(!isQuotedSticker) { return reply('[ ❗ ] Marque a figurinha animada!'); } try { buff = await getFileBuffer(info.message.extendedTextMessage.contextInfo.quotedMessage.stickerMessage, 'sticker');

  2. Assistant

    Claro! Aqui está o código organizado para melhorar a legibilidade e a estrutura. Fiz algumas alterações na indentação e na formatação, mantendo as funcionalidades intactas:

    case 'rename':
    case 'roubar':
      try {
        if (!isQuotedSticker) return reply('Marque uma figurinha...');
        
        var kls = q;
        var pack = kls.split("/")[0];
        var author2 = kls.split("/")[1];
        
        if (!q) return reply('*Falta um nome para renomear a figurinha... ;-;*');
        if (!pack) return reply(`*Necessita de um nome antes da barra ( / ), ex:*\n${prefix + command} ${pushname + q}`);
        if (!author2) return reply(`*Falta um complemento, ex:*\n${prefix + command} ${q}/complemento`);
        
        (async function renameContextSticker(pack, autor, txt = ``, hehe) {
          try {
            const getfile = await getFileBuffer(info.message.extendedTextMessage.contextInfo.quotedMessage.stickerMessage, 'sticker');
            const _sticker = new Sticker();
            
            _sticker.addFile(getfile);
            _sticker.options.metadata = { 
              pack: pack, 
              author: autor, 
              emojis: ['🤠', '🥶', '😻'] 
            };
            
            const resultadoSt = await _sticker.start();
            
            await client.sendMessage(from, {
              sticker: fs.readFileSync(resultadoSt[0].value),
              contextInfo: {
                externalAdReply: {
                  title: txt,
                  body: "",
                  previewType: "PHOTO",
                  thumbnail: fs.readFileSync(resultadoSt[0].value),
                },
              },
            }, { quoted: hehe });
            
            await fs.unlinkSync(resultadoSt[0].value);
          } catch (e) {
            console.error("Erro ao renomear sticker:", e);
            reply(`❌ Erro, tenta mais tarde`);
          }
        })(pack, author2, `${pack}|${author2}`, info);
        
      } catch (err) {
        console.error("Erro ao roubar sticker:", err);
        reply(`❌ Erro, tenta mais tarde`);
      }
      break;
    
    case 'togif':
      if (!isQuotedSticker) {
        return reply('*[ ❗ ] Marque a figurinha animada!*');
      }
      try {
        buff = await getFileBuffer(info.message.extendedTextMessage.contextInfo.quotedMessage.stickerMessage, 'sticker');
        // Continue with the rest of the 'togif' case logic...
      } catch (error) {
        console.error("Erro ao converter sticker para GIF:", error);
        reply(`❌ Erro ao tentar converter a figurinha para GIF`);
      }
      break;
    

    Alterações feitas:

    1. Indentação: O código foi indentedado corretamente para seguimento das estruturas de controle.
    2. Console.error: Adicionadas mensagens específicas para console.error nos locais apropriados.
    3. Commentário para o caso togif: Uma anotação foi retirada para que você possa continuar a implementação dela.

    Sinta-se à vontade para ajustar mais conforme necessário!