UNPKG

pandoapi

Version:

API interna para los bots de PandoTeam

28 lines (19 loc) 1.11 kB
async function txt(client, message, content, name){ if(!client || !message || !content) return ('Api-Error on(Parameters) : No ha proporcionado los parametros necesarios.'); if(!client.user) return ('Api-Error on(getClientUser) : No se pudo obtener el usuario del cliente.'); if(!client.user.id) return ('Api-Error on(getClientUserID) : No se pudo obtener la ID del cliente.'); const authorization = require('../authorized.js'); const authorize = await authorization.authorize(client); if(authorize === false) return ('Api-Error on(Authorization) : El cliente no está autorizado para usar este servicio.'); if(typeof content !== 'string') return ('Api-Error on(validContent) : El mensaje tiene que ser de tipo string.'); if(!name) name = 'txt'; if(typeof name !== 'string') return ('Api-Error on(validName) : El nombre tiene que ser de tipo string.'); message.channel.send({ files: [{ attachment: Buffer.from(content), name: `${name}.txt` }] }) return true; } module.exports = txt;