Guest User

Untitled

a guest
Dec 19th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. var inquirer = require('inquirer');
  2. var clear = require("cli-clear");
  3. var fs = require("fs");
  4. var yaml = require("js-yaml");
  5. clear();
  6. console.log("\n Megamind \n v2.0 \n Coded by rjt.rockx \n")
  7. var doc = yaml.safeLoad(fs.readFileSync('config.yaml', 'utf8'));
  8.  
  9. var questions = [
  10. {
  11. type: 'input',
  12. name: 'discord_email',
  13. message: 'Email ID'
  14. },
  15. {
  16. type: 'password',
  17. message: 'Password',
  18. name: 'discord_password'
  19. }
  20. ];
  21. var credentials = {d_email:"",d_pass:""};
  22. inquirer.prompt(questions).then(function (answers) {
  23. credentials.d_email = JSON.parse(JSON.stringify(answers, null, ' ')).discord_email;
  24. credentials.d_pass = JSON.parse(JSON.stringify(answers, null, ' ')).discord_password;
  25.  
  26. var Discord = require("discord.js");
  27. var selfbot = new Discord.Client();
  28. selfbot.login(credentials.d_email,credentials.d_pass);
  29.  
  30.  
  31. // ------------------------------------------------------------------------------------------------------------------------------------
  32. //
  33. // BOT CODE
  34. //
  35. // ------------------------------------------------------------------------------------------------------------------------------------
  36.  
  37.  
  38. selfbot.on('ready', () => {
  39. console.log("\n");
  40. console.log(`Logged in as ${selfbot.user.username}#${selfbot.user.discriminator}`);
  41. selfbot.channels.get(doc.logchannel).sendMessage(`Logged in as ${selfbot.user.username}#${selfbot.user.discriminator}`);
  42. });
  43.  
  44. var doAction = [function(bot, doc, msg){}];
  45.  
  46. selfbot.on('message', msg => {
  47. if ((msg.content.startsWith(doc.prefix)&& (!(msg.author.bot)))&&msg.author.id===selfbot.user.id)
  48. {
  49. var loguser = "**User : **" + msg.author.username + "**#" + msg.author.discriminator + "**";
  50. var logcontent = "**Content : ** \n" + msg.cleanContent;
  51. var logplace = "** Location : ** #" + msg.channel.name + " in " + msg.guild;
  52. var msgtime = msg.createdAt;
  53. var logdate = msgtime.getFullYear()+'/'+(msgtime.getMonth()+1)+'/'+msgtime.getDate();
  54. var logtime = msgtime.getHours() + ":" + msgtime.getMinutes() + ":" + msgtime.getSeconds();
  55. var logdatetime = logdate+' '+logtime;
  56. var logtime = "** Time : **" + logdatetime;
  57. var logdetails = loguser + "\n" + logcontent + "\n" + logplace + "\n" + logtime;
  58. selfbot.channels.get(doc.logchannel).sendMessage(logdetails);
  59. try{
  60. var messagecontent = msg.content;
  61. messagecontent = messagecontent.toLowerCase().trim();
  62. for(i=0;i<doAction.length;i++)
  63. doAction[i](selfbot,doc,msg,messagecontent);
  64. }
  65. catch(error){
  66. console.log(error);
  67. }
  68. }
  69. /* if(msg.isMentioned(selfbot.user.id)&&msg.author.id!==selfbot.user.id){
  70. if(doc.afkmsg!=="mgmdafk"){
  71. msg.reply(selfbot.user.username + " is afk. \n" + doc.afkmsg)
  72. }
  73. if(doc.afkmsg==="mgmdafk"){
  74. msg.reply(selfbot.user.username + " is afk.")
  75. }
  76. } */
  77. });
  78.  
  79. // Lenny
  80.  
  81. doAction.push(function something(bot, doc, msg, content){
  82. if(content.startsWith(doc.prefix + "lenny")){
  83. var newcontent = "( ͡° ͜ʖ ͡°)";
  84. if(msg.editable)
  85. {
  86. msg.edit(newcontent);
  87. }
  88. if(!msg.editable)
  89. {
  90. msg.reply(newcontent);
  91. }
  92. }
  93. });
  94.  
  95. // Bootify
  96.  
  97. doAction.push(function something(bot, doc, msg, content){
  98. if(content.startsWith(doc.prefix + "bootify")){
  99. var newcontent=content;
  100. if(msg.editable)
  101. {
  102. msg.edit("", {embed: {
  103. title: "~---==Eval==---~",
  104. color: 0xe1ee17,
  105. fields: [{
  106. name: "something",
  107. value: "something"
  108. }, {
  109. name: "somethingelse",
  110. value: "somethingelse"
  111. }]
  112. }});
  113. }
  114. if(!msg.editable)
  115. {
  116. msg.reply("", {embed: {
  117. title: "Something",
  118. color: 0xFF0000,
  119. fields: [{
  120. name: "Message",
  121. value: "test"
  122. }]
  123. }});
  124. }
  125. }
  126. });
  127.  
  128.  
  129. // ------------------------------------------------------------------------------------------------------------------------------------
  130. //
  131. // END OF BOT CODE
  132. //
  133. // ------------------------------------------------------------------------------------------------------------------------------------
  134.  
  135.  
  136. });
Add Comment
Please, Sign In to add comment