Advertisement
Guest User

Inferno Bot

a guest
May 6th, 2018
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.88 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const { RichEmbed } = require('discord.js');
  3. var roblox = require('roblox-js');
  4.  
  5. const TOKEN = "TOKEN HERE";
  6. const PREFIX = "!";
  7. const client = new Discord.Client();
  8.  
  9.  
  10. var bot = new Discord.Client();
  11. var groupId = 4076603;
  12. var maximumRank = 255;
  13.  
  14. roblox.login({username: "USERNAME", password: "PASSWORD"}).then((success) => {
  15.  
  16. }).catch(() => {console.log("Sorry, it failed.");});
  17.  
  18. var fortunes = [
  19. "Yes",
  20. "No",
  21. "Maybe",
  22. ];
  23.  
  24. function pluck(array){
  25. return array.map(function(item) { return item['name']; })
  26. }
  27.  
  28. function hasRole(members, role){
  29. if (members.roles==null){
  30. return false;
  31. }
  32. if(pluck(members.roles).includes(role)){
  33. return true;
  34. } else {
  35. return false;
  36. }
  37. }
  38. //383757830928465931
  39. function isGuild(message, id){
  40. if(message.guild.available){
  41. if(message.guild.id == id){
  42. return true
  43. } else {
  44. return false
  45. }
  46. } else {
  47. return false
  48. }
  49. }
  50.  
  51. function isRole(message, name){
  52. return message.member.roles.find("name", name)
  53. }
  54.  
  55. function isAdmin(message){
  56. try {
  57. eval(message['member']['roles']);
  58. } catch(error){
  59. return false;
  60. }
  61.  
  62. if(
  63. isRole(message, "SHR") ||
  64. isRole(message, "s")
  65. ){
  66.  
  67. return true;
  68. } else {
  69. return false;
  70. }
  71. }
  72.  
  73. bot.on("ready", () => {
  74. console.log("Ready");
  75. bot.user.setGame("!help | Hotels");
  76. });
  77.  
  78. bot.on("message", message => {
  79. if (message.author.bot) return;
  80. if (!message.content.startsWith(PREFIX)) return;
  81. var args = message.content.substring(PREFIX.length).split(" ");
  82.  
  83. switch (args[0].toLowerCase()) {
  84. case "training":
  85. message.channel.send({embed: {
  86. color: 3447003,
  87. author: {
  88. name: message.author.tag,
  89. icon_url: message.author.avatarURL
  90. },
  91. title: "",
  92. fields: [{
  93. name: "Link to Guide",
  94. value: "https://goo.gl/YMW6rq"
  95. },
  96. {
  97. name: "Shout Format",
  98. value: "Beginning: ``[TRAINING] are being hosted at TIME by HOST! Head on down to the training center for a chance of a promotion!``\nSlocked: ``[TRAINING] have been s-locked! Sorry if you could not make it, why not head on down to the hotel to cheer you up?``\nCompleted: ``[TRAINING] are now over! Sorry if you could not make it or failed, why not head on down to the hotel to cheer you up?``"
  99. },
  100. {
  101. name: "Training Stages",
  102. value: "> Reception Training\n> Chef Training\n> Theory Training"
  103. },
  104. {
  105. name: "Promotions",
  106. value: "Trainees will need 1.5/4 points.\nJunior Receptionists will need 2/4 points.\nSenior Receptionists will need 4/4 (IV/IV) points."
  107. }
  108. ],
  109. footer: {
  110. text: "Before you host, you must put your session on the Trello! https://trello.com/b/0AYncCEw"
  111. }
  112. }
  113. });
  114. break;
  115. case "interview":
  116. message.channel.send({embed: {
  117. color: 3447003,
  118. author: {
  119. name: message.author.tag,
  120. icon_url: message.author.avatarURL
  121. },
  122. title: "",
  123. fields: [{
  124. name: "Link to Guide",
  125. value: "https://goo.gl/6aLPPT"
  126. },
  127. {
  128. name: "Shout Format",
  129. value: "Beginning: ``[INTERVIEWS] are being hosted at TIME by HOST! Head on down to the interview center for a chance of a job!``\nSlocked: ``[INTERVIEWS] have been s-locked! Sorry if you could not make it, why not head on down to the hotel to cheer you up?``\nCompleted: ``[INTERVIEWS] are now over! Sorry if you could not make it or failed, why not head on down to the hotel to cheer you up?``"
  130. },
  131. {
  132. name: "Interview Questions",
  133. value: "I. Please correct this sentence: “hullo welcom to nolva hotels hotel how may i help u?” \n^ If they don’t correct it right, they have failed.\nII. Why do you want to work for us?\nIII. Why should we hire you?\nIV. Have you ever worked in another ROBLOX company? If so, where\nV. How would your rate your grammar skills?\nVI. How would you rate your activity on roblox?\nVII. Describe to us how you would treat a customer."
  134. },
  135. ],
  136. footer: {
  137. text: "Before you host, you must put your session on the Trello! https://trello.com/b/0AYncCEw"
  138. }
  139. }
  140. });
  141. break;
  142.  
  143. case "report":
  144.  
  145. //!report @ned this is the reason
  146.  
  147. let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  148. if(!rUser) return message.channel.send("Couldn't find user.");
  149. let rreason = args.join(" ").slice(22);
  150.  
  151. let reportEmbed = new Discord.RichEmbed()
  152. .setDescription("Nolva Hotels | Reported User")
  153. .setColor("#15f153")
  154. .addField("Reported User", `${rUser} with ID: ${rUser.id}`)
  155. .addField("Reported By", `${message.author} with ID: ${message.author.id}`)
  156. .addField("Channel", message.channel)
  157. .addField("Time", message.createdAt)
  158. .addField("Reason", rreason);
  159.  
  160. let reportschannel = message.guild.channels.find(`name`, "reports");
  161. if(!reportschannel) return message.channel.send("Couldn't find reports channel.");
  162.  
  163.  
  164. message.delete().catch(O_o=>{});
  165. reportschannel.send(reportEmbed);
  166.  
  167. return;
  168.  
  169. case "ban":
  170.  
  171. let bUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  172. if(!bUser) return message.channel.send("Can't find user!");
  173. let bReason = args.join(" ").slice(22);
  174. if(!message.member.hasPermission("MANAGE_MEMBERS")) return message.channel.send("No can do pal!");
  175. if(bUser.hasPermission("MANAGE_MESSAGES")) return message.channel.send("That person can't be kicked!");
  176.  
  177. let banEmbed = new Discord.RichEmbed()
  178. .setDescription("Nolva Hotels | Ban Report")
  179. .setColor("#bc0000")
  180. .addField("Banned User", `${bUser} with ID ${bUser.id}`)
  181. .addField("Banned By", `<@${message.author.id}> with ID ${message.author.id}`)
  182. .addField("Banned In", message.channel)
  183. .addField("Time", message.createdAt)
  184. .addField("Reason", bReason);
  185.  
  186. let incidentchannel = message.guild.channels.find(`name`, "incidents");
  187. if(!incidentchannel) return message.channel.send("Can't find incidents channel.");
  188.  
  189. message.guild.member(bUser).ban(bReason);
  190. incidentchannel.send(banEmbed);
  191.  
  192.  
  193. return;
  194.  
  195. case "announce":
  196. if (message.member.hasPermission("ADMINISTRATOR")) {
  197. const color = args[0]
  198.  
  199. const text = args.slice(1).join(" ");
  200. if (text.length < 1) return message.channel.send("Can not announce nothing");
  201. //const colour = args.slice(2).join("");
  202. const embed = new Discord.RichEmbed()
  203. .setColor("0x" + color)
  204. .setTitle(" Hotels Server Announcement:")
  205. .setDescription(text);
  206. message.channel.send("@everyone")
  207. message.channel.send({embed})
  208. }
  209.  
  210. return;
  211.  
  212. case "kick":
  213.  
  214. //!kick @daeshan askin for it
  215.  
  216. let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  217. if(!kUser) return message.channel.send("Can't find user!");
  218. let kReason = args.join(" ").slice(22);
  219. if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("No can do pal!");
  220. if(kUser.hasPermission("MANAGE_MESSAGES")) return message.channel.send("That person can't be kicked!");
  221.  
  222. let kickEmbed = new Discord.RichEmbed()
  223. .setDescription("v Hotels | Kick Report")
  224. .setColor("#e56b00")
  225. .addField("Kicked User", `${kUser} with ID ${kUser.id}`)
  226. .addField("Kicked By", `<@${message.author.id}> with ID ${message.author.id}`)
  227. .addField("Kicked In", message.channel)
  228. .addField("Tiime", message.createdAt)
  229. .addField("Reason", kReason);
  230.  
  231. let kickChannel = message.guild.channels.find(`name`, "incidents");
  232. if(!kickChannel) return message.channel.send("Can't find incidents channel.");
  233.  
  234. message.guild.member(kUser).kick(kReason);
  235. kickChannel.send(kickEmbed);
  236.  
  237. return;
  238.  
  239. case "help":
  240. var embed = new Discord.RichEmbed()
  241. .setColor("#FF9900")
  242. .addField("<<< Command List >>>", "Use !help <command name> for details", true)
  243. .addField("<< Fun Commands >>", true)
  244. .addField("!8ball", "Rolls an 8 Ball.", true)
  245. .addField("!reverse", "Reverses Text", true)
  246. .addField("!yomama", "Tells the mentioned user a Yo Mama Joke.", true)
  247. .addField("<< Miscellaneous >>", true)
  248. .addField("!botinfo", "Gives some useful bot information.", true)
  249. .addField("!botstats", "Gives some useful bot statistics.", true)
  250. .addField("!permlevel", "Tells you your permission level for the current message location.", true)
  251. .addField("!ping", "It... like... pings. Then Pongs. And it's not Ping Pong.", true)
  252. .addField("!serverinfo", "Gives some useful bot information.", true)
  253. .addField("<< ROBLOX >>", true)
  254. .addField("!getrank", "Loads the ROBLOX rank for the specified ROBLOX user.", true)
  255. .addField("!robloxinfo", "Loads the ROBLOX information for the specified ROBLOX user.", true)
  256. .addField("!interview", "Shows you the guides for interviews.", true)
  257. .addField("!training", "Shows you the guides for trainings.", true)
  258. .addField("!restorerank", "Gives you back your rank in the previous Nolva Hotels group.", true)
  259. .addField("<< SYSTEM >>")
  260. .addField("!help", "Displays all the available commands for your permission levels", true)
  261. .setFooter("Nolva Hotels | Bot")
  262. message.channel.sendEmbed(embed);
  263. break;
  264. case "botinfo":
  265. var embed = new Discord.RichEmbed()
  266. .setColor("#FF9900")
  267. .setAuthor(message.author.tag, message.author.avatarURL)
  268. .addField("Name", "BOT TAG")
  269. .addField("Head Developer", "<@399982462245011456>")
  270. .addField("Developers", `<@399982462245011456>`)
  271. .addField("User's Serving", bot.users.size, true)
  272. .addField("Channels", bot .channels.size, true)
  273. .addField("Commands", "!help", true)
  274. .addField("Scripting Language", "JavaScript", true)
  275. .addField("Current Version", "1.7.1", true)
  276. .addField("Main Sponsor", " Hotels", true)
  277. .setThumbnail(bot.user.avatarURL)
  278. message.channel.sendEmbed(embed);
  279. break;
  280. case "ping":
  281. const msg = message.channel.send("Ping?");
  282. message.channel.send(`Pong! Latency is ${msg.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
  283. break;
  284. case "info":
  285. message.channel.send("I'm a Super Bot Created by Reece!");
  286. break;
  287. case "demote":
  288. message.channel.send("Sorry, This command is still under development!");
  289. break;
  290. case "8ball":
  291. if (!args[2]) return message.reply("Please ask a full question!");
  292. let replies = ["Yes.", "No.", "I don't know", ":crystal_ball: Ask me again later."];
  293.  
  294. let result = Math.floor((Math.random() * replies.length));
  295. let question = args.slice(1).join(" ");
  296.  
  297. let ballembed = new Discord.RichEmbed()
  298. .setAuthor(message.author.tag)
  299. .setColor("#FF9900")
  300. .addField("Answer", replies[result]);
  301.  
  302. message.channel.send(ballembed);
  303. break;
  304. case "buy":z
  305. message.channel.send("Our Prices are as Follow's: ***Personal £2/$2 Turbo £4/$4 Enterprise £6/$6*** Thank you");
  306. break;
  307. case "admin":
  308. if(isAdmin(message)){
  309. console.log("User is a admin")
  310. } else {
  311. console.log("User is not a admin.")
  312. }
  313. case "promote":
  314. if(isAdmin(message)){
  315. var username = args[1]
  316. if (username){
  317. message.channel.send()
  318. roblox.getIdFromUsername(username)
  319. .then(function(id){
  320. roblox.getRankInGroup(groupId, id)
  321. .then(function(rank){
  322. if(maximumRank <= rank){
  323. message.channel.send(``)
  324. } else {
  325. message.channel.send()
  326. roblox.promote(groupId, id)
  327. .then(function(roles){
  328. var embed = new Discord.RichEmbed()
  329. .setColor("#FF9900")
  330. .setAuthor(message.author.tag, message.author.avatarURL)
  331. .setDescription("User has been successfully ranked, but unable to be messaged.")
  332. message.channel.sendEmbed(embed);
  333. }).catch(function(err){
  334. message.channel.send("Failed to promote.")
  335. });
  336. }
  337. }).catch(function(err){
  338. message.channel.send("Couldn't get him in the group.")
  339. });
  340. }).catch(function(err){
  341. message.channel.send(`Sorry, but ${username} doesn't exist on ROBLOX.`)
  342. });
  343. } else {
  344. message.channel.send("Please enter a username.")
  345. }
  346. return;
  347. } else {
  348. message.channel.send("")
  349. }
  350.  
  351. case "fire":
  352. if(isAdmin(message)){
  353. var username = args[1]
  354. if (username){
  355. roblox.getIdFromUsername(username)
  356. .then(function(id){
  357. roblox.getRankInGroup(groupId, id)
  358. .then(function(rank){
  359. if(maximumRank < rank){
  360. } else {
  361. roblox.setRank(groupId, id, 2)
  362. .then(function(roles){
  363. var embed = new Discord.RichEmbed()
  364. .setColor("#FF9900")
  365. .setAuthor(message.author.tag, message.author.avatarURL)
  366. .setDescription("User has been successfully ranked, but unable to be messaged.")
  367. message.channel.sendEmbed(embed);
  368. }).catch(function(err){
  369. });
  370. }
  371. }).catch(function(err){
  372. message.channel.send("Couldn't get him in the group.")
  373. });
  374. }).catch(function(err){
  375. message.channel.send(`Sorry, but ${username} doesn't exist on ROBLOX.`)
  376. });
  377. } else {
  378. message.channel.send("Please enter a username.")
  379. }
  380. return;
  381. } else {
  382. message.channel.send("")
  383. }
  384. default:
  385. message.channel.send("You do not have permission to use this command.\n Your permission level is 0 (User)\n This command requires level 15 (Hotel SHR)");
  386.  
  387. }
  388. });
  389.  
  390. bot.login(TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement