Advertisement
Guest User

Untitled

a guest
Jul 28th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. require('dotenv').config();
  2.  
  3. const Discord = require('discord.js');
  4. const client = new Discord.Client();
  5. const yg = require('./yg');
  6. const mrhaircut = require('./mrhaircut');
  7.  
  8. const snoowrap = require('snoowrap');
  9.  
  10. const r = new snoowrap({
  11. userAgent: 'discord-reddit',
  12. clientId: process.env.ID,
  13. clientSecret: process.env.SECRET,
  14. username: process.env.USERNAME,
  15. password: process.env.PASSWORD
  16. })
  17.  
  18. client.on('ready', () => {
  19. console.log('i am ready');
  20. });
  21.  
  22. client.on('message', (message) => {
  23.  
  24. let arr = [];
  25. function handleArray(arr) {
  26.  
  27. message.channel.send(arr[Math.floor(Math.random() * arr.length)]);
  28. }
  29.  
  30. function whichUser() {
  31. let users = ['mrhaircut33', 'staticeruption', 'skb96', 'ibolightweightchamp', 'wrong_ladder', 'whiterangerrollins', 'lIlIlIlIIlIIl', 'thelastemp', 'bestchestinthewest69', 'ken_milawski'];
  32.  
  33. return users[Math.floor(Math.random() * users.length)];
  34. }
  35.  
  36. if (message.content.startsWith('rr')) {
  37. let data = r.getUser(whichUser())
  38. .getComments()
  39. .map(comment => {
  40. if (comment.subreddit_name_prefixed === 'r/Boxing') {
  41. arr.push(comment.body)
  42. }
  43. })
  44. .then(() => handleArray(arr))
  45. }
  46.  
  47. if (message.content.startsWith('skb')) {
  48. let data = r.getUser('skb96')
  49. .getComments()
  50. .map(comment => {
  51. if (comment.subreddit_name_prefixed === 'r/Boxing') {
  52. arr.push(comment)
  53. }
  54. })
  55. .then(() => handleArray(arr))
  56. }
  57.  
  58. if (message.content.startsWith('wrr')) {
  59. let data = r.getUser('whiterangerrollins')
  60. .getComments()
  61. .map(comment => arr.push(comment.body))
  62. .then(() => handleArray(arr));
  63. }
  64.  
  65. if (message.content.startsWith('hh')) {
  66. let data = r.getUser('Chris_Jericho')
  67. .getComments()
  68. .map(comment => arr.push(comment.body))
  69. .then(() => handleArray(arr));
  70. }
  71.  
  72. if (message.content.startsWith('stu')) {
  73. let data = r.getUser('wrong_ladder')
  74. .getComments()
  75. .map(comment => arr.push(comment.body))
  76. .then(() => handleArray(arr));
  77. }
  78.  
  79. if (message.content.startsWith('mr')) {
  80. let data = r.getUser('mrhaircut33')
  81. .getComments()
  82. .map(comment => arr.push(comment.body))
  83. .then(() => handleArray(arr));
  84. }
  85.  
  86. if (message.content.startsWith('rob')) {
  87. let data = r.getUser('thelastemp')
  88. .getComments()
  89. .map(comment => arr.push(comment.body))
  90. .then(() => handleArray(arr));
  91. }
  92.  
  93. if (message.content.startsWith('ry')) {
  94. let data = r.getUser('ryang_123')
  95. .getComments()
  96. .map(comment => arr.push(comment.body))
  97. .then(() => handleArray(arr));
  98. }
  99.  
  100. if (message.content.startsWith('josh')) {
  101. let data = r.getUser('bestchestinthewest69')
  102. .getComments()
  103. .map(comment => arr.push(comment.body))
  104. .then(() => handleArray(arr));
  105. }
  106.  
  107. if (message.content.startsWith('ken')) {
  108. let data = r.getUser('ken_milawski')
  109. .getComments()
  110. .map(comment => {
  111. if (comment.subreddit_name_prefixed === 'r/Boxing') {
  112. arr.push(comment)
  113. }
  114. })
  115. .then(() => handleArray(arr));
  116. }
  117.  
  118.  
  119. if (message.content.startsWith('yg')) {
  120. message.channel.send('4hunnid');
  121. }
  122. if (message.content.startsWith('suu')) {
  123. message.channel.send('whoop');
  124. }
  125. if (message.content.startsWith('fdt')) {
  126. message.channel.send('fuck donald trump');
  127. }
  128.  
  129. if (message.content === '@ everyone') {
  130. message.channel.send('<@&426446423513497600>')
  131. }
  132.  
  133. if (message.content.startsWith(':vince1:')) {
  134. message.channel.send(':vince0:');
  135. }
  136.  
  137. // if (message.content) {
  138. // //grab the actual message
  139. // let msg = message.content;
  140. // //check if the message isn't null and the author isn't the bot (keeps him from repeating himself)
  141. // if (msg.length > 0 && message.author.id !== '459015311275065365' && /^c|(?<=\s)[c]/g.test(msg)) {
  142. // //yg-ify the message
  143. // let ygSpeak = yg(msg);
  144.  
  145. // //send the yg message to the channel
  146. // message.channel.send(`<@${message.author.id}> show some respect. it's ${ygSpeak}`);
  147. // }
  148. // }
  149.  
  150. if (message.content === 'bompton') {
  151. message.react('🔴');
  152. }
  153.  
  154. if (message.content === 'what time is the fight') {
  155. message.channel.send('use the fucking calendar you jabroni')
  156. }
  157.  
  158. })
  159.  
  160.  
  161. client.login(process.env.DISCORD_TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement