Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. var mineflayer = require('mineflayer');
  2. var bot = mineflayer.createBot({
  3. host: "4b4t.us", // optional
  4. port: 25565, // optional
  5. username: "maxmaurisson@hotmail.fr",
  6. password: "papa1998",
  7. });
  8.  
  9. bot.on('chat', (username, message) => {
  10. if (message === '$seed') {
  11. bot.chat('> The seed for 4b4t is 2354472788974084399')
  12. }
  13. })
  14. bot.on('chat', (username, message) => {
  15. if (message === '$owner') {
  16. bot.chat('> DuluthMN is the owner of this bot')
  17. }
  18. })
  19. bot.on('chat', (username, message) => {
  20. if (message === '$creator') {
  21. bot.chat('> DuluthMN is the creator of this bot')
  22. }
  23. })
  24. bot.on('chat', (username, message) => {
  25. if (message === '$kill' && username === 'DuluthMN') {
  26. bot.chat('/kill')
  27. }})
  28.  
  29. bot.on('message', (message) => {
  30. console.log(message.toAnsi())
  31. })
  32.  
  33. bot.on('chat', (username, message) => {
  34. if (username === bot.username) return
  35. switch (message) {
  36. case '$sleep':
  37. goToSleep()
  38. break
  39. case '$wakeup':
  40. wakeUp()
  41. break
  42. }
  43. })
  44.  
  45. bot.on('$sleep', () => {
  46. bot.chat('> Good night!')
  47. })
  48. bot.on('$wake', () => {
  49. bot.chat('> Good morning!')
  50. })
  51.  
  52. function goToSleep () {
  53. const bed = bot.findBlock({
  54. matching: 26
  55. })
  56. if (bed) {
  57. bot.sleep(bed, (err) => {
  58. if (err) {
  59. bot.chat(`I cant sleep: ${err.message}`)
  60. } else {
  61. bot.chat("> Im sleeping")
  62. }
  63. })
  64. } else {
  65. bot.chat('> No nearby bed')
  66. }
  67. }
  68.  
  69. function wakeUp () {
  70. bot.wake((err) => {
  71. if (err) {
  72. bot.chat(`I cant wake up: ${err.message}`)
  73. } else {
  74. bot.chat('> I woke up')
  75. }
  76. })
  77. }
  78. bot.on('chat', (username, message) => {
  79. if (message === '$tpahere' && username === 'DuluthMN') {
  80. bot.chat('/tpa' + ' ' + username)
  81. bot.chat('> Teleporting' + ' ' + 'to' + ' ' + username)
  82. }})
  83.  
  84. bot.on('chat', (username, message) => {
  85. if (message === '$discord' && username === 'DuluthMN') {
  86. bot.chat('/w' + ' ' + username + "https://discord.gg/fqbm3qz")
  87. }})
  88. bot.on('chat', (username, message) => {
  89. if (message === '$commands' && username === 'DuluthMN') {
  90. bot.chat('> my commands are $tp00 $seed $owner $sleep $creator talk to DuluthMN for ideas of more commands')
  91. }})
  92.  
  93.  
  94. function sleep(delay) {
  95. var start = new Date().getTime();
  96. while (new Date().getTime() < start + delay);
  97. }
  98.  
  99. let target = null
  100. bot.on('chat', (username, message) => {
  101. if (username === bot.username)
  102. target = bot.players[username].entity
  103. })
  104.  
  105. function watchTarget () {
  106. if (!target) return
  107. bot.lookAt(target.position.offset(0, target.height, 0))
  108. }
  109. var elina;
  110.  
  111. //var options2 = { host: 'constantiam.net',
  112. // port: 25565,
  113. // username: 'second username here (optional)',
  114. // password: 'second passowrd here (optional)',
  115. // verbose: true
  116. //}
  117.  
  118. //elina = mineflayer.createBot(options2)
  119. //var lastmessage
  120. //var premessage
  121.  
  122. //bot.on('chat', (username, message) => {
  123. // if (message !== premessage && username !== bot.username) {
  124. //sleep(500)
  125. //lastmessage = message
  126. //elina.chat('4b4t.us: [' + username + ']' + ' ' + message)
  127. //}})
  128.  
  129. //elina.on('chat', (username, message) => {
  130. //if (message !== lastmessage && username !== bot.username) {
  131. //sleep(500)
  132. //premessage = message
  133. //bot.chat('Constantium.net: [' + username + ']' + ' ' + message)
  134. //}})
  135.  
  136. var stdin = process.openStdin();
  137. stdin.addListener("data", function(d) {
  138. bot.chat(d.toString().trim());
  139. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement