Reorganize este código JS mantendo a lógica, mas melhorando a estrutura: var budy =…
- User
Reorganize este código JS mantendo a lógica, mas melhorando a estrutura:
var budy = (type === 'conversation') ? info.message?.conversation : (type === 'extendedTextMessage') ? info.message?.extendedTextMessage?.text : ''; const reply = (text) => { client.sendMessage(from, {text: text}, {quoted: selo}) } const envia = (text) => { client.sendMessage(from, {text: text}, {quoted: selo}) } const enviar = (text) => { client.sendMessage(from, {text: text}, {quoted: selo}) }
var pes = (type === 'conversation' && info.message.conversation) ? info.message.conversation : (type == 'imageMessage') && info.message.imageMessage.caption ? info.message.imageMessage.caption : (type == 'videoMessage') && info.message.videoMessage.caption ? info.message.videoMessage.caption : (type == 'extendedTextMessage') && info.message.extendedTextMessage.text ? info.message.extendedTextMessage.text : ''
const quoted = info.quoted ? info.quoted : info
const isBot = info.key.fromMe ? true : false
/////////////////////////////////////////////// //IS DO ANTIPV***\ /////////////////////////////////////////////// const isAntiPv = (antipv.indexOf('Ativado') >= 0) ? true : false const isAnticall = (anticall.indexOf('Ativado') >= 0) ? true : false const isWelcomed = (groupIdWelcomed.indexOf(from) >= 0) ? true : false const bye_group = JSON.parse(fs.readFileSync('./arquivos/funções/grupos/byegp.json')); const path = require('path'); const groupIdBye = [] for(let obj of bye_group) groupIdBye.push(obj.id) const isByed = (groupIdBye.indexOf(from) >= 0) ? true : false /////////////////////////////////////////////// //FUNÇÕES DO ANAGRAMA E LEVEL ///////////////////////////////////////////////
const pushname = info.pushName ? info.pushName : '' const username = info.username ? info.username : '' const isGroup = from.endsWith('@g.us'); const sender = isGroup ? info.key.participant.includes(':') ? info.key.participant.split(':')[0] +'@s.whatsapp.net': info.key.participant : info.key.remoteJid; const addLevelingXp = (userId, amount) => {
- Assistant