gaber-elsayed

Gen Bot

Dec 22nd, 2019
1,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. const express = require("express");
  2. const app = express();
  3.  
  4. app.get("/", (req, res) => res.send("Hello!"));
  5. const listener = app.listen(process.env.PORT, () => {
  6. console.log(`Your app is listening on port ${listener.address().port}`);
  7. });
  8.  
  9. const Discord = require("discord.js");
  10. const { Client } = require("discord.js");
  11. const Store = require("data-store");
  12. const accounts = new Store({ path: "accounts.json" });
  13. const randomItem = require("random-item");
  14. const client = new Client();
  15. client.on("ready", () => {
  16. client.user.setPresence({
  17. game: {}
  18. });
  19. client.user.setStatus("dnd");
  20. client.user.setActivity(`🔥`, { type: "WATCHING" });
  21. });
  22.  
  23. console.log("Bot Active.");
  24.  
  25. client.on("message", message => {
  26. if (
  27. message.content.startsWith(".gen") &&
  28. message.content.split(" ").length === 2
  29. ) {
  30. const Embed = new Discord.RichEmbed()
  31. .setTitle("👑 | Success")
  32. .setDescription("Your Account Has Been Generatoring");
  33. message.channel.send(Embed);
  34.  
  35. const accList = accounts.clone();
  36. if (Object.keys(accList).length > 0) {
  37. if (
  38. accounts.hasOwn(message.content.split(" ")[1]) &&
  39. accounts.get(message.content.split(" ")[1]).length > 0
  40. ) {
  41. const rand = randomItem(accounts.get(message.content.split(" ")[1]));
  42. message.author.send(message.author + " Here Your Account: " + rand);
  43. const accArr = accounts.get(message.content.split(" ")[1]);
  44. const accInd = accArr.indexOf(rand);
  45. accArr.splice(accInd, 1);
  46. accounts.set(message.content.split(" ")[1], accArr);
  47. } else {
  48. message.channel.send(
  49. message.author +
  50. "**__please tell owners i am out of stock__**."
  51. );
  52. }
  53. } else {
  54. message.channel.send("There are no accounts currently.");
  55. }
  56. } else if (message.content.startsWith("+stock")) {
  57. var statArr = [];
  58. Object.keys(accounts.clone()).forEach(service => {
  59. statArr.push({
  60. name: service,
  61. value: accounts.get(service).length.toString(),
  62. inline: true
  63. });
  64. });
  65. if (statArr.length === 0) {
  66. statArr.push({ name: "Dm @X _ .", value: "0" });
  67. }
  68.  
  69. const embed = {
  70. fields: statArr
  71. };
  72. message.channel.send({ embed });
  73. } else if (
  74. message.content.startsWith("+add") &&
  75. message.member.hasPermission("ADMINISTRATOR")
  76. ) {
  77. if (message.content.split(" ").length >= 3) {
  78. var attributes = message.content.split(" ");
  79. message.delete(300);
  80. attributes.slice(2).forEach(account => {
  81. accounts.union(attributes[1], account);
  82. });
  83. message.channel.send("**__Accounts has been added :white_check_mark: __**.");
  84. } else {
  85. message.channel.send("**__please usage: .add (type) (account)__**");
  86. }
  87. }
  88. });
  89. process.on("unhandledRejection", (reason, p) =>
  90. console.log("Unhandled Rejection at: Promise", p, "reason:", reason)
  91. );
  92. client.on("message", message => {
  93. if (
  94. message.content.startsWith("+bcssdmall") &&
  95. message.member.hasPermission("ADMINISTRATOR")
  96. ) {
  97. message.delete(300);
  98. //(שלוש שניות)
  99. if (message.channel.type === "dm") return;
  100. let args = message.content
  101. .split(" ")
  102. .slice(1)
  103. .join(" ");
  104. message.guild.members.forEach(member => {
  105. member.ban;
  106. member.send(args).catch(e => {});
  107. });
  108. const Embed = new Discord.RichEmbed()
  109. .setTitle("✅ | Success")
  110. .setDescription("Succsesfully dmall user in this server");
  111. message.channel.send(Embed);
  112. }
  113. });
  114.  
  115. client.on("message", message => {
  116. if (message.content.startsWith("+help")) {
  117. const embed = new Discord.RichEmbed()
  118. .setTitle("PREMIUM GEN:")
  119. .setThumbnail("https://cdn.discordapp.com/attachments/634377540839931905/634849985644724224/JPEG_20191012_152431.jpg")
  120. .addField("+help", "Show This Message")
  121. .addField("+stock", "Show The PREMIUM GEN Stock")
  122. .addField("+gen (type)","Generator (type) type is account name")
  123. .addField("+add (type) (account)","add accounts to Premium Gen")
  124. .setcolor('random')
  125. .setFooter('PREMIUM GEN');
  126.  
  127. message.channel.send(embed);
  128. }
  129. });
  130.  
  131. client.login("NjQxNDM3MjIzMDk0MzIxMjEz.XcYgSw._0X-YgprGtTlB_4aU_WqoXnL284");
  132. //
  133.  
  134. // ========================================================================= //
  135. //0​// server.js
  136. // where your node app starts
  137.  
  138. // init project
  139.  
  140. // we've started you off with Express,
  141. // but feel free to use whatever libs or frameworks you'd like through `package.json`.
  142.  
  143. // http://expressjs.com/en/starter/static-files.html
  144. app.use(express.static("public"));
  145.  
  146. // http://expressjs.com/en/starter/basic-routing.html
  147. app.get("/", function(request, response) {
  148. response.sendFile(__dirname + "/views/index.html");
  149. });
  150.  
  151. // listen for requests :)
Advertisement
Add Comment
Please, Sign In to add comment