Advertisement
Reflexay

Untitled

Mar 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.82 KB | None | 0 0
  1. console.log("Iniciando o bot...");
  2. const Discord = require("discord.js");
  3. const client = new Discord.Client();
  4.  
  5. const config = require("./config.json");
  6.  
  7. client.on("ready", () => {
  8. console.log(`Bot iniciado, com ${client.users.size} users, em ${client.channels.size} canais de ${client.guilds.size} grupos.`);
  9. client.user.setPresence({ game: { name: 'vocês jogarem no Rapex', type: 3 } });
  10. });
  11.  
  12. client.on("message", async message => {
  13.  
  14. if(message.author.bot) return;
  15.  
  16. if(message.content.indexOf(config.prefix) !== 0) return;
  17.  
  18. const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
  19. const command = args.shift().toLowerCase();
  20.  
  21. client.on("guildMemberAdd", function(member) {
  22. client.guilds.get(member.guild.id).members.get(member.id).addRole(member.guild.roles.find("name", "Membro").id)
  23. })
  24.  
  25. if(command === "aplicar") {
  26. const m = await message.channel.send({"embed": {
  27. "title": "Quer se aplicar para a staff?",
  28. "description": "Para se aplicar, escolha para que quer se aplicar, e preencha o formulario",
  29. "url": "",
  30. "color": 4437732,
  31. "timestamp": new Date(),
  32. "footer": {
  33. "icon_url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  34. "text": "RapexBOT"
  35. },
  36. "thumbnail": {
  37. "url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  38. },
  39. "image": {
  40. "url": ""
  41. },
  42. "author": {
  43. "name": "RapexBOT",
  44. "url": "https://minecraft.net",
  45. "icon_url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  46. },
  47. "fields": [
  48. {
  49. "name": "Formularios para a aplicação",
  50. "value": "Formulario para Trial [Clique aqui](https://pastebin.com/40DXkBq6)\nFormulario para ModGC [Clique aqui](https://pastebin.com/dwLRDu8A)\nFormulario para Helper [Clique aqui](https://pastebin.com/zuqQtWs0)\n\nPara se aplicar para builder, chame o Reflexay no privado, e envie prints de suas ultimas 3 construções."
  51.  
  52. }
  53.  
  54. ]
  55. }
  56. });
  57. }
  58. if(command === "bot") {
  59. const m = await message.channel.send("Bot feito por: @Reflexayy");
  60. }
  61.  
  62.  
  63. if(command === "comandos") {
  64. const m = await message.channel.send({"embed": {
  65. "title": "Use os comandos no canal #comandos-dos-bots",
  66. "description": "```Usar os comandos em um canal inadequado, resulta em punição```",
  67. "url": "",
  68. "color": 4437732,
  69. "timestamp": new Date(),
  70. "footer": {
  71. "icon_url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  72. "text": "RapexBOT"
  73. },
  74. "thumbnail": {
  75. "url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  76. },
  77. "image": {
  78. "url": ""
  79. },
  80. "author": {
  81. "name": "RapexBOT",
  82. "url": "https://minecraft.net",
  83. "icon_url": "https://media.discordapp.net/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  84. },
  85. "fields": [
  86. {
  87. "name": "Comandos",
  88. "value": "!aviso (aviso)\n!kick (user) (motivo)\n!ban (user) (motivo)\n!aplicar\n!bot\n!roleta\n!demote (user)\n!promote (user)\n!mute (user) (motivo)\n!limpar (numero)\n!report (user) (motivo)\n!falarembed (texto)\n!sugerir (sugestão)\n!comandos"
  89.  
  90. }
  91.  
  92. ]
  93. }
  94. });
  95.  
  96.  
  97. }
  98. if(command === "falar") {
  99. if(!message.member.roles.some(r=>["Dono 👑" , "Diretor 🏆" , "Social Manager🔧"].includes(r.name)) )
  100. return message.reply("Desculpe, apenas meus gerenciadores pode usar esse comando");
  101.  
  102. const sayMessage = args.join(" ");
  103. message.delete().catch(O_o=>{});
  104. message.channel.send(sayMessage);
  105. }
  106.  
  107. if (message.content.startsWith("!roleta")){
  108. randomnumber = Math.floor(Math.random() * (3 - 1) + 1);
  109. if (randomnumber == 2){
  110. message.reply("Você ganhou");
  111. }
  112. else{
  113. message.reply("Você perdeu");
  114. }
  115. }
  116.  
  117. if(command === "aviso") {
  118. if(!message.member.roles.some(r=>["Dono 👑" , "Diretor 🏆" , "Social Manager🔧" , "Admin 🔪" , "Gerente 🔧"].includes(r.name)) )
  119. return message.reply("Desculpe, apenas meu gerenciador pode usar esse comando");
  120.  
  121. const sayAviso = args.join(" ");
  122. message.delete().catch(O_o=>{});
  123. client.guilds.get("422039606330916874").channels.get("422063665735532544").send({embed: {
  124. color: 3447003,
  125. author: {
  126. name: "RapexAvisos",
  127. icon_url: client.user.avatarURL
  128. },
  129. title: "RapexAvisos",
  130. url: "",
  131. description: "",
  132. fields: [{
  133. name: "𛲡",
  134. value: `${sayAviso} \n𛲡`
  135. }
  136. ],
  137. timestamp: new Date(),
  138. footer: {
  139. icon_url: client.user.avatarURL,
  140. text: "RapexAvisos"
  141. }
  142. }
  143. });
  144.  
  145. }
  146.  
  147. if(command === "kick") {
  148. if(!message.member.roles.some(r=>["Dono 👑" , "YT+ 📷" , "Diretor 🏆" , "Staff Manager 🔧" , "Social Manager🔧" , "ModGC 💣" , "Admin 🔪" , "Gerente 🔧" , "Moderador 🎈" , "Trial ❌"].includes(r.name)) )
  149. return message.reply("Desculpe, apenas administradores podem usar esse comando");
  150.  
  151. let member = message.mentions.members.first();
  152. if(!member)
  153. return message.reply("Uso correto: /kick (@user) (motivo)");
  154. if(!member.kickable)
  155. return message.reply("Não tenho permissão para isso");
  156.  
  157. let reason = args.slice(1).join(' ');
  158. if(!reason)
  159. return message.reply("Por favor, indique um motivo para a expulsão");
  160.  
  161. await member.kick(reason)
  162. .catch(error => message.reply(`Sorry ${message.author} não posso expulsar, Error: ${error}`));
  163. message.delete().catch(O_o=>{});
  164. client.guilds.get("422039606330916874").channels.get("422063694009073675").send({"embed": {
  165. "title": "RapexPunições",
  166. "description": "Um usuario foi punido.",
  167. "url": "",
  168. "color": 4437732,
  169. "timestamp": new Date(),
  170. "footer": {
  171. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  172. "text": "RapexPunições"
  173. },
  174. "thumbnail": {
  175. "url": ""
  176. },
  177. "image": {
  178. "url": ""
  179. },
  180. "author": {
  181. "name": "RapexPunições",
  182. "url": "",
  183. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  184. },
  185. "fields": [
  186.  
  187. {
  188. "name": "Usuario punido",
  189. "value": `${member.user}`
  190. },
  191. {
  192. "name": "Motivo",
  193. "value": `${reason}`
  194. },
  195. {
  196. "name": "Punição",
  197. "value": "Kick",
  198. "inline": true
  199. },
  200. {
  201. "name": "Autor da punição",
  202. "value": `${message.author}`,
  203. "inline": true
  204. }
  205. ]
  206. }
  207. });
  208.  
  209. }
  210.  
  211. if(command === "ban") {
  212. if(!message.member.roles.some(r=>["Dono 👑" , "Diretor 🏆" , "Staff Manager 🔧" , "Social Manager🔧" , "ModGC 💣" , "Moderador 🎈" , "Admin 🔪" , "Gerente 🔧"].includes(r.name)) )
  213. return message.reply("Desculpe, apenas moderadores podem usar esse comando");
  214.  
  215. let member = message.mentions.members.first();
  216. if(!member)
  217. return message.reply("Uso correto: /ban (@user) (motivo)");
  218. if(!member.bannable)
  219. return message.reply("Não tenho permissão para isso");
  220.  
  221. let reason = args.slice(1).join(' ');
  222. if(!reason)
  223. return message.reply("Por favor, indique um motivo para o banimento");
  224.  
  225. await member.ban(reason)
  226. .catch(error => message.reply(`Sorry ${message.author} não posso banir, Error: ${error}`));
  227. message.delete().catch(O_o=>{});
  228. client.guilds.get("422039606330916874").channels.get("422063694009073675").send({"embed": {
  229. "title": "RapexPunições",
  230. "description": "Um usuario foi punido.",
  231. "url": "",
  232. "color": 4437732,
  233. "timestamp": new Date(),
  234. "footer": {
  235. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  236. "text": "RapexPunições"
  237. },
  238. "thumbnail": {
  239. "url": ""
  240. },
  241. "image": {
  242. "url": ""
  243. },
  244. "author": {
  245. "name": "RapexPunições",
  246. "url": "",
  247. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  248. },
  249. "fields": [
  250.  
  251. {
  252. "name": "Usuario punido",
  253. "value": `${member.user}`
  254. },
  255. {
  256. "name": "Motivo",
  257. "value": `${reason}`
  258. },
  259. {
  260. "name": "Punição",
  261. "value": "Banimento",
  262. "inline": true
  263. },
  264. {
  265. "name": "Autor da punição",
  266. "value": `${message.author}`,
  267. "inline": true
  268. }
  269. ]
  270. }
  271. });
  272.  
  273. }
  274.  
  275. if(command === "mute") {
  276. if(!message.member.roles.some(r=>["Dono 👑" , "YT+ 📷" , "Diretor 🏆" , "Staff Manager 🔧" , "Social Manager🔧" , "ModGC 💣" , "Admin 🔪" , "Gerente 🔧" , "Moderador 🎈" , "Trial ❌"].includes(r.name)) )
  277. return message.reply("Desculpe, apenas administradores podem usar esse comando");
  278.  
  279. let member = message.mentions.members.first();
  280. if(!member)
  281. return message.reply("Uso correto: !mute (@user) (motivo)");
  282.  
  283. let reason = args.slice(1).join(' ');
  284. if(!reason)
  285. return message.reply("Por favor, indique um motivo para o mute");
  286.  
  287. member.guild.members.get(member.id).addRole(member.guild.roles.find("name", "Mutado").id);
  288. member.guild.members.get(member.id).removeRole(member.guild.roles.find("name", "Membro").id);
  289. message.delete().catch(O_o=>{});
  290. client.guilds.get("422039606330916874").channels.get("422063694009073675").send({"embed": {
  291. "title": "RapexPunições",
  292. "description": "Um usuario foi punido.",
  293. "url": "",
  294. "color": 4437732,
  295. "timestamp": new Date(),
  296. "footer": {
  297. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  298. "text": "RapexPunições"
  299. },
  300. "thumbnail": {
  301. "url": ""
  302. },
  303. "image": {
  304. "url": ""
  305. },
  306. "author": {
  307. "name": "RapexPunições",
  308. "url": "",
  309. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  310. },
  311. "fields": [
  312.  
  313. {
  314. "name": "Usuario punido",
  315. "value": `${member.user}`
  316. },
  317. {
  318. "name": "Motivo",
  319. "value": `${reason}`
  320. },
  321. {
  322. "name": "Punição",
  323. "value": "Mute",
  324. "inline": true
  325. },
  326. {
  327. "name": "Autor da punição",
  328. "value": `${message.author}`,
  329. "inline": true
  330. }
  331. ]
  332. }
  333. });
  334.  
  335. }
  336.  
  337. if(command === "report") {
  338.  
  339. let member = message.mentions.members.first();
  340. if(!member)
  341. return message.reply("Uso correto: !report (@user) (motivo)");
  342.  
  343. let reason = args.slice(1).join(' ');
  344. if(!reason)
  345. return message.reply("Por favor, indique um motivo para o report");
  346. message.delete().catch(O_o=>{});
  347.  
  348. client.guilds.get("422039606330916874").channels.get("422440572352200706").send("@everyone",{
  349. "content": "@everyone",
  350. "embed": {
  351. "title": "RapexReports",
  352. "description": "Um usuario foi reportado.",
  353. "url": "",
  354. "color": 4437732,
  355. "timestamp": new Date(),
  356. "footer": {
  357. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  358. "text": "RapexReports"
  359. },
  360. "thumbnail": {
  361. "url": ""
  362. },
  363. "image": {
  364. "url": ""
  365. },
  366. "author": {
  367. "name": "RapexReports",
  368. "url": "",
  369. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  370. },
  371. "fields": [
  372.  
  373. {
  374. "name": "Usuario reportado",
  375. "value": `${member.user}`
  376. },
  377. {
  378. "name": "Motivo",
  379. "value": `${reason}`,
  380. "inline": true
  381. },
  382. {
  383. "name": "Autor da report",
  384. "value": `${message.author}`,
  385. "inline": true
  386. }
  387. ]
  388. }
  389. });
  390.  
  391. }
  392.  
  393. if(command === "sugerir") {
  394.  
  395. const saySugest = args.join(" ");
  396. message.delete().catch(O_o=>{});
  397.  
  398. client.guilds.get("422039606330916874").channels.get("422583562521542657").send({"embed": {
  399. "title": "RapexSugestões",
  400. "description": "Chegou uma nova sugestão",
  401. "url": "",
  402. "color": 4437732,
  403. "timestamp": new Date(),
  404. "footer": {
  405. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png",
  406. "text": "RapexSugestões"
  407. },
  408. "thumbnail": {
  409. "url": ""
  410. },
  411. "image": {
  412. "url": ""
  413. },
  414. "author": {
  415. "name": "RapexSugestões",
  416. "url": "",
  417. "icon_url": "https://cdn.discordapp.com/attachments/376542824339865623/422103064267456543/LOGO_V2.1.png"
  418. },
  419. "fields": [
  420.  
  421. {
  422. "name": "Sugestão",
  423. "value": `${saySugest}`,
  424. "inline": true
  425. },
  426. {
  427. "name": "Autor da sugestão",
  428. "value": `${message.author}`,
  429. "inline": true
  430. }
  431. ]
  432. }
  433. });
  434.  
  435. }
  436.  
  437. if(command === "falarembed") {
  438. if(!message.member.roles.some(r=>["Dono 👑" , "Diretor 🏆" , "Social Manager🔧" , "Admin 🔪" , "Gerente 🔧"].includes(r.name)) )
  439. return message.reply("Desculpe, apenas meus gerenciadores pode usar esse comando");
  440.  
  441. const saySelf = args.join(" ");
  442. message.delete().catch(O_o=>{});
  443. message.channel.send({embed: {
  444. color: 3447003,
  445. author: {
  446. name: client.user.username,
  447. icon_url: client.user.avatarURL
  448. },
  449. title: "Um membro da staff disse:",
  450. url: "",
  451. description: "",
  452. fields: [{
  453. name: "𛲡",
  454. value: `${saySelf} \n𛲡`
  455. },
  456. {
  457. name: "Mensagem enviada por:",
  458. value: `${message.author}`
  459. }
  460. ],
  461. timestamp: new Date(),
  462. footer: {
  463. icon_url: client.user.avatarURL,
  464. text: "RapexBOT"
  465. }
  466. }
  467. });
  468. }
  469.  
  470. if(command === "limpar") {
  471. if(!message.member.roles.some(r=>["Dono 👑" , "Staff Manager 🔧" , "Social Manager🔧" , "ModGC 💣" , "YT+ 📷" , "Admin 🔪" , "Gerente 🔧" , "Moderador 🎈" , "Trial ❌"].includes(r.name)) ) return message.reply("Desculpe, apenas meus gerenciadores podem usar esse comando");
  472. let reason = args.slice(0).join(' ');
  473. if (reason.length < 1) return message.reply('**Diga a quantidade de mensagens que devo apagar!**');
  474. message.channel.bulkDelete(`${args[0]}`)
  475. setTimeout(function() {s
  476. message.channel.sendMessage(`**:wastebasket: ${args[0]} mensagens foram apagadas por <@${message.author.id}> !**`).then((value) => {
  477. setTimeout(() => {
  478. value.delete();
  479. }, 5000);
  480. });
  481. }, 2000)
  482. }
  483. });
  484.  
  485.  
  486. client.login(config.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement