Advertisement
Guest User

Untitled

a guest
Jan 28th, 2017
4,646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.98 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3. const token = 'Mjc0OTQxMjI4NTE1MTk2OTI4.C25brA.Ye3WtHacvoXXQ3ENJN8MWbHl_LU'
  4. //const Webhook = require("webhook-discord")
  5. //const Hook = new Webhook("https://discordapp.com/api/webhooks/271011939797172244/c3F2ofv3vJoPnkSCmhmDzzxtxvR1k2xdaOwYd8yTM20MZYy05UWNlgRR5ovckyLE1_jq")
  6. var Twitter = require('twitter');
  7. var google = require('google')
  8. google.resultsPerPage = 5
  9. var nextCounter = 5
  10.  
  11. var rbx = require('roblox-js');
  12. var jar = rbx.options.jar;
  13. var options = {
  14. username: 'dodNUSA',
  15. password: 'boi no'
  16. }
  17.  
  18. bot.on('ready', () => {
  19. bot.user.setGame("!developers, curently under " + bot.guilds.size + " server(s).");
  20. console.log('Turned on!');
  21.  
  22.  
  23.  
  24.  
  25. });
  26. const prefix = "!";
  27.  
  28.  
  29. bot.on("guildMemberAdd", member =>{
  30. let guild = member.guild;
  31. let role = guild.roles.find("name", "US Citizen");
  32. member.addRole(role).catch(console.error);
  33. console.log("User " + member.user + "'s role has been changed.")
  34. guild.defaultChannel.sendMessage("Welcome, " + member.user + " to the US Department of Defense Discord server. Please verify your ROBLOX account with your Discord account in the text channel, #verification-channel. Run '!verify <USERID> <USERNAME>', thanks!")
  35. });
  36.  
  37. bot.on("guildMemberRemove", member =>{
  38. });
  39.  
  40. bot.on("guildMemberUpdate", member => {
  41. let guild = member.guild;
  42.  
  43. });
  44.  
  45. bot.on('message', message => {
  46. if(message.author.bot) return;
  47. console.log(`${message.guild} | ${message.author.username} said: "${message.content} - ${message.channel}".`);
  48.  
  49.  
  50. if (message.content.startsWith(prefix + "function")) {
  51. console.log("Ran functionc command.")
  52. message.channel.sendMessage("Basic function - Limit the amount of bots in the IC Discord server. This bot was programmed so it met the IC's needs. Nothing less, nothing more.")
  53. }
  54.  
  55.  
  56. if (message.content.startsWith(prefix + "tweet")) {
  57. let modRole = message.guild.roles.find("name", "Moderator");
  58. if (!message.member.roles.has(modRole.id)) {
  59. return message.channel.sendMessage("Hell no kid, you can't run this powerful command.")
  60. }
  61. message.delete()
  62.  
  63. let args = message.content.split(" ").slice(1);
  64. client.post('statuses/update', {status: message.content.slice(message.content.indexOf(message.content.split(" ")[1]))}, function(error, tweet, response) {
  65. return message.channel.sendMessage("tweet sent. **NOTE: Tweets may only be 140 characters. Make sure you didn't go over!**")
  66. if (!error) {
  67.  
  68. }
  69. });
  70. }
  71.  
  72.  
  73. if (message.content.startsWith(prefix + "discordshout")) {
  74. let modRole = message.guild.roles.find("name", "Moderator");
  75. if (!message.member.roles.has(modRole.id)) {
  76. return message.channel.sendMessage("Hell no kid, you can't run this powerful command.")
  77. }
  78. message.delete()
  79. let args = message.content.split(" ").slice(1);
  80. message.channel.sendMessage(" :warning: System Announcement :warning: \n" + message.content.slice(message.content.indexOf(message.content.split(" ")[1])));
  81. }
  82.  
  83. if (message.content.toLowerCase().includes("anarchasdjlaskdji29djndalskjy")) {
  84. message.delete()
  85. message.channel.sendMessage("This is your emergency broadcast system announcing the commencement of the Annual Purge sanctioned by the U.S. Government.", {
  86. tts: true
  87. });
  88. message.channel.sendMessage("Weapons of class 4 and lower have been authorized for use during the Purge. All other weapons are restricted.", {
  89. tts: true
  90. });
  91. message.channel.sendMessage("And for the first time since its inception, no one has been granted special immunity from the Purge. No citizen or group will be exempt.", {
  92. tts: true
  93. });
  94. message.channel.sendMessage("Commencing at the siren, any and all crime, including murder, will be legal for 12 continuous hours.", {
  95. tts: true
  96. });
  97. message.channel.sendMessage("Police, fire, and emergency medical services will be unavailable until tomorrow morning until 7 a.m., when The Purge concludes.", {
  98. tts: true
  99. });
  100. message.channel.sendMessage("Blessed be our New Founding Fathers and America, a nation reborn. May God be with you all", {
  101. tts: true
  102. });
  103. }
  104.  
  105.  
  106. if (message.content.startsWith(prefix + "countdown")) {
  107. let i = 60;
  108. message.channel.sendMessage("Countdown: " + i + "s").then(message => {
  109. var countInterval = setInterval(() => {
  110. if(i === 10) {
  111. message.edit(i = "Countdown complete.");
  112. return clearInterval(countInterval);
  113. }
  114. message.edit("Countdown: " + (i = i - 10) + "s")
  115. }, 10000);
  116. })
  117. }
  118.  
  119.  
  120.  
  121.  
  122. if (message.content.startsWith(prefix + "OSD")) {
  123. console.log("Ran ODNI command.")
  124. message.channel.sendMessage("The SECDEF is devGralius.");
  125. message.channel.sendMessage("The DSECDEF is GolfGames1.");
  126. message.channel.sendMessage("The ESECDEF is TBA.");
  127. message.channel.sendMessage("The USECDEFs are TBA");
  128. }
  129.  
  130.  
  131. rbx.login(options)
  132. .then(function (info) {
  133. console.log('Logged in with ID ' + info.userId)
  134. })
  135. .catch(function (err) {
  136. console.error(err.stack);
  137. });
  138.  
  139.  
  140.  
  141.  
  142. if (message.content.startsWith(prefix + "membercount")) {
  143. console.log("User ran MemberCount command")
  144. message.delete()
  145. message.channel.sendMessage("There are currently " + message.guild.memberCount + " members here.");
  146. }
  147.  
  148. if (message.content.startsWith(prefix + "prune")) {
  149. let modRole = message.guild.roles.find("name", "Moderator");
  150. if (!message.member.roles.has(modRole.id)) {
  151. return Hook.error("DOD | Check System", message.author + " you don't have the correct role to run this command.")
  152. }
  153. let args = message.content.split(" ").slice(1);
  154. let amount = args[0];
  155. message.channel.bulkDelete(amount);
  156. return Hook.success("DOD | Check System", "Pruned messages " + message.author)
  157.  
  158. console.log('Pruned messages!')
  159. }
  160.  
  161.  
  162.  
  163.  
  164. if (message.content.startsWith(prefix + "verify")) {
  165. let args = message.content.split(" ").slice(1);
  166. let amount = args[0];
  167.  
  168. let godRole = message.guild.roles.find("name", "Verified");
  169. if (message.member.roles.has(godRole.id)) {
  170. return message.reply("Already verified, please contact an administrator if you're having a problem.")
  171. }
  172. message.reply("please check your ROBLOX.com messages. We've messaged you with a verification code, follow instructions found in the message. **Change your settings so all users can message, you may change your settings back once verified.** \nCopy and paste the specific code that was sent to you.")
  173.  
  174. var code = [
  175. "asdlkasdlkjasdlkj&2918347",
  176. "faslkdasldoij$28",
  177. "sfdklsdflksdjflskdfjl%",
  178. "sdlkfjsdlkfjsdlfkjsdlfkjsdflkjqw123123123",
  179. "asldkfasdlkfj*@#(@3812391238)",
  180. "zlkjxvlkzjxcvlkjzxcvlk2u34e902183102938",
  181. "sdflksdflksdf12812392389",
  182. "asdlkasldasdaksdjvxbcvxcvi128u!!!",
  183. "asdlfkjasdflkjasdflkjasdfuq30984q023948;;213123",
  184. "vjksdanvzxcviewr839"
  185. ]
  186. let zz = code[Math.floor(Math.random()*code.length)]
  187. rbx.login(options)
  188. .then(function (info) {
  189. rbx.message(args[0], "DOD | Verification", "Dear user, \nA user on the Department of Defesne discord has submitted a verification for their discord account to be linked with this ROBLOX account. If you did not submit this verification then please ignore this message.\n \nHowever, if you did send the message please copy and paste the specific code below onto our discord. \n" + "\n" + zz + "\n" + "\nKind regards, \ndodNUSA", jar)
  190.  
  191. })
  192.  
  193.  
  194. .then(() => {
  195. message.channel.awaitMessages(response => code.includes(response.content), {
  196. max: 1,
  197. time: 60000,
  198. errors: ['time'],
  199. })
  200. .then((collected) => {
  201. message.delete()
  202. let member = message.author
  203. let guild = member.guild;
  204. message.member.setNickname(args[1])
  205. message.member.addRole(message.guild.roles.find('name', 'Verified')).catch(console.error);
  206. message.author.sendMessage("You've been officially verified!");
  207. })
  208.  
  209. .catch((c) => {
  210. console.log(c)
  211. message.channel.sendMessage('Please try again later...');
  212. });
  213. })
  214. }
  215.  
  216. if (message.author.id === administrators){
  217. var administrators = [
  218. 155882812241608704,
  219. 206987665139040258,
  220. 140680852286865408,
  221. 155491975594901505,
  222. 136219388645736448
  223. ]
  224. if (message.content.startsWith(prefix + "allshout")) {
  225. let modRole = message.guild.roles.find("name", "Moderator");
  226. if (!message.member.roles.has(modRole.id)) {
  227. return Hook.error("DOD | Check System", message.author + " you don't have the correct role to run this command.")
  228. }
  229. let argss = message.content.split(" ").slice(1);
  230. rbx.login(options)
  231. .then(function (info) {
  232. rbx.shout(1158256, message.content.slice(message.content.indexOf(message.content.split(" ")[1])), jar)
  233. rbx.shout(860594, message.content.slice(message.content.indexOf(message.content.split(" ")[1])), jar)
  234. rbx.shout(761706, message.content.slice(message.content.indexOf(message.content.split(" ")[1])), jar)
  235. rbx.shout(758071, message.content.slice(message.content.indexOf(message.content.split(" ")[1])), jar)
  236. rbx.shout(761515, message.content.slice(message.content.indexOf(message.content.split(" ")[1])), jar)
  237. })
  238. .catch(function (err) {
  239. console.error(err.stack);
  240. });
  241. return Hook.success("DOD | Check System","Shouted by " + message.author + " with a message of ```" + message.content.slice(message.content.indexOf(message.content.split(" ")[1])) + "```")
  242. }
  243. }
  244.  
  245.  
  246. if (message.content.startsWith(prefix + "fbiexile")) {
  247. let modRole = message.guild.roles.find("name", "Moderator");
  248. if (!message.member.roles.has(modRole.id)) {
  249. return Hook.error("DOD | Check System", message.author + " you don't have the correct role to run this command.")
  250. }
  251. rbx.login(options)
  252. .then(function (info) {
  253. rbx.exile(761706, args[1], jar)
  254. })
  255. .catch(function (err) {
  256. console.error(err.stack);
  257. });
  258. return Hook.success("DOD | Check System", message.author + " user has been exiled.")
  259. }
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267. if (message.content.startsWith(prefix + "cmds")) {
  268. message.author.sendMessage("The commands to run the DOD bot are... \n \n!developers \n!function \n!countdown \nODNI \n!ICAdministration \n!membercount \n!prune \n!message \n!allshout \n!nsaexile \nicexile \n!fbiexile \n!lockdown \n!unlockdown \n!mute \n!spam \n!warn \n!kick \n!ban \n!info \n!avtar \n!ping \n!news ")
  269. }
  270.  
  271.  
  272.  
  273. if (message.content.startsWith(prefix + "mute")) {
  274. let modRole = message.guild.roles.find("name", "Moderator");
  275. if (!message.member.roles.has(modRole.id)) {
  276. return message.reply("you don't have the correct role to run this command.");
  277. }
  278. let user = message.guild.member(message.mentions.users.first())
  279. let role = message.guild.roles.find("name", "Mute");
  280. user.addRole(role).catch(console.error);
  281. return Hook.success("DOD | Check System", "The mentioned user has been muted " + message.author)
  282.  
  283. };
  284.  
  285.  
  286.  
  287. if (message.content.startsWith(prefix + "kick")) {
  288. let modRole = message.guild.roles.find("name", "Moderator");
  289. if(!message.member.roles.has(modRole.id)) {
  290. return Hook.error("DOD | Check System", message.author + " you don't have the correct role to run this command.")
  291. }
  292. if(message.mentions.users.size === 0) {
  293. return Hook.error("DOD | Check System", message.author + " mention a user to kick")
  294. }
  295. let kickMember = message.guild.member(message.mentions.users.first());
  296. if(!kickMember) {
  297. return Hook.error("DOD | Check System", message.author + " user isn't in the server.")
  298. }
  299.  
  300. if(!message.guild.member(bot.user).hasPermission("KICK_MEMBERS")) {
  301. return message.reply("sorry! I don't have the permissions to do this. ");
  302. }
  303. let args = message.content.split(" ").slice(1);
  304. message.mentions.users.first().sendMessage();
  305. kickMember.kick().then(member => {
  306. return Hook.success("DOD | Check System", member.user.username + " was kicked by " + message.author + " with reason of ```" + message.content.slice(message.content.indexOf(message.content.split(" ")[2])) + "```")
  307. }).catch(e => {
  308. console.error(e);
  309. console.log("Kick command ran by " + member.user)
  310. });
  311. }
  312.  
  313. if (message.content.startsWith(prefix + "ban")) {
  314. let modRole = message.guild.roles.find("name", "Moderator");
  315. if(!message.member.roles.has(modRole.id)) {
  316. return Hook.error("DOD | Check System", message.author + " you don't have the correct role to run this command.")
  317. }
  318. if(message.mentions.users.size === 0) {
  319. return Hook.error("DOD | Check System", message.author + " mention a user to ban.")
  320. }
  321. let banMember = message.guild.member(message.mentions.users.first());
  322. if(!banMember) {
  323. return Hook.error("DOD | Check System", message.author + " user isn't in the server")
  324. }
  325.  
  326. if(!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")) {
  327. return message.reply("Sorry! I don't have the permissions to do this. ");
  328. }
  329. banMember.ban().then(member => {
  330. return Hook.success("DOD | Check System", member.user.username + " was banned by " + message.author + message.author + " with reason of ```" + message.content.slice(message.content.indexOf(message.content.split(" ")[2])) + "```")
  331. }).catch(e => {
  332. console.error(e);
  333. console.log("RAN BAN COMMAND")
  334. });
  335. }
  336.  
  337.  
  338. if (message.content.startsWith(prefix + "join")) {
  339. // Iterate over all channels
  340. for (var channel of message.channel.server.channels) {
  341. // If the channel is a voice channel, ...
  342. if (channel instanceof Discord.VoiceChannel) {
  343. // ... reply with the channel name and the ID ...
  344. client.reply(m, channel.name + " - " + channel.id);
  345. // ... and join the channel
  346. client.joinVoiceChannel(channel).catch(error);
  347. // Afterwards, break the loop so the bot doesn't join any other voice
  348. // channels
  349. break;
  350. }
  351. }
  352. }
  353. });
  354.  
  355.  
  356.  
  357.  
  358. bot.login('Mjc0OTQxMjI4NTE1MTk2OTI4.C25brA.Ye3WtHacvoXXQ3ENJN8MWbHl_LU');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement