Advertisement
Guest User

ta ae

a guest
Apr 21st, 2019
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js")
  2. const fs = require("fs")
  3. const tokenfile = require("../token.json")
  4. module.exports.run = async (bot, message, args, prefix) =>{
  5. if(message.author.id !== "370007502643003403" && message.author.id !== "519192605511254017") return message.channel.send("C TEM DEMENCIA?")
  6. message.channel.send("Qual o nome do arquivo?")
  7. const filter = b => !b.author.bot && b.author.id == message.author.id
  8.  
  9. const a = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  10. a.on("collect", async d => {
  11. this.arquivo = d.content
  12.  
  13. message.channel.send(`O nome do arquivo será: \`${this.arquivo}\`? (digite qualquer coisa menos "nao" para continuar)`)
  14. const b = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  15. b.on("collect", async e => {
  16. this.resposta = e.content
  17. this.listaN = this.resposta === "cancelar" || this.resposta === "Naum" || this.resposta === "naum" || this.resposta === "Cancelar"
  18.  
  19. if(this.listaN){
  20.     return message.channel.send("operaçaum cançelada")
  21. }
  22.  
  23.  
  24. message.channel.send("oq ira conter dentro do comandos")
  25. const u = await message.channel.createMessageCollector(filter, {max: 1, time: 500000,})
  26. u.on("collect", async comando => {
  27. this.conterarquivo = comando.content
  28. message.channel.send("Qual o nome do comando?")
  29.  
  30. const ç = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  31. ç.on("collect", async nome => {
  32. this.name = nome.content
  33. message.channel.send("Quais sao os aliases comando?")
  34.  
  35. const e = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  36. e.on("collect", async aliases => {
  37. this.aliases = aliases.content
  38.  
  39. message.channel.send("So para ops?")
  40. const f = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  41. f.on("collect", async OPS => {
  42. this.ops = OPS.content
  43. message.channel.send("Qual a descricão?")
  44.  
  45. const desc = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  46. desc.on("collect", async descricaum => {
  47. this.description = descricaum.content
  48. message.channel.send("Qual a categoria do comando?")
  49.  
  50. const categoria = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  51. categoria.on("collect", async clousse => {
  52. this.categoria = clousse.content
  53. message.channel.send("Como usar o comando?")
  54.  
  55. const Usage = await message.channel.createMessageCollector(filter, {max: 1, time: 30000,})
  56. Usage.on("collect", async usage => {
  57. this.usage = usage.content
  58.  
  59. if(comando.content){
  60.     try{
  61.     const f = require(`./${this.arquivo}`)
  62.     if(f){
  63.         return message.channel.send("este arquivo ja existe")
  64.     }
  65. }
  66.     catch(e){
  67.         fs.writeFile(`./comandos/${this.arquivo}`, `const Discord = require("discord.js") \n` +
  68.         `module.exports.run = async (bot, message, args, prefix, database) => { \n` +
  69.         `${this.conterarquivo} \n` +
  70.         `} \n` +
  71.         `exports.config = { \n` +
  72.         `   name: "${this.name}", \n` +
  73.         `   alias: ${this.aliases}, \n` +
  74.         `   ops: "${this.ops}", \n` +
  75.         `   description: "${this.description}", \n` +
  76.         `   categoria: "${this.categoria}", \n` +
  77.         `   usage: "${this.usage}" \n` +
  78.         `}`, encoding='utf8', async function(err){
  79.             if (err) throw err;
  80.             await message.channel.send(`comando criado`)
  81.             .then(async () => await bot.destroy(5000))
  82.             .then(async () => await bot.login(tokenfile.token));
  83.         })
  84.     }
  85. }
  86. })
  87. })
  88. })
  89. })
  90. })
  91. })
  92. })
  93. })
  94. })
  95. }
  96. exports.config = {
  97.     name: "createmodule",
  98.     alias: ["create_module", "create_file", "create_cmd", "createfile", "createcmd"],
  99.     ops: "sim"
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement