Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mineflayer = require('mineflayer');
- var bot = mineflayer.createBot({
- host: "4b4t.us", // optional
- port: 25565, // optional
- username: "maxmaurisson@hotmail.fr",
- password: "papa1998",
- });
- bot.on('chat', (username, message) => {
- if (message === '$seed') {
- bot.chat('> The seed for 4b4t is 2354472788974084399')
- }
- })
- bot.on('chat', (username, message) => {
- if (message === '$owner') {
- bot.chat('> DuluthMN is the owner of this bot')
- }
- })
- bot.on('chat', (username, message) => {
- if (message === '$creator') {
- bot.chat('> DuluthMN is the creator of this bot')
- }
- })
- bot.on('chat', (username, message) => {
- if (message === '$kill' && username === 'DuluthMN') {
- bot.chat('/kill')
- }})
- bot.on('message', (message) => {
- console.log(message.toAnsi())
- })
- bot.on('chat', (username, message) => {
- if (username === bot.username) return
- switch (message) {
- case '$sleep':
- goToSleep()
- break
- case '$wakeup':
- wakeUp()
- break
- }
- })
- bot.on('$sleep', () => {
- bot.chat('> Good night!')
- })
- bot.on('$wake', () => {
- bot.chat('> Good morning!')
- })
- function goToSleep () {
- const bed = bot.findBlock({
- matching: 26
- })
- if (bed) {
- bot.sleep(bed, (err) => {
- if (err) {
- bot.chat(`I cant sleep: ${err.message}`)
- } else {
- bot.chat("> Im sleeping")
- }
- })
- } else {
- bot.chat('> No nearby bed')
- }
- }
- function wakeUp () {
- bot.wake((err) => {
- if (err) {
- bot.chat(`I cant wake up: ${err.message}`)
- } else {
- bot.chat('> I woke up')
- }
- })
- }
- bot.on('chat', (username, message) => {
- if (message === '$tpahere' && username === 'DuluthMN') {
- bot.chat('/tpa' + ' ' + username)
- bot.chat('> Teleporting' + ' ' + 'to' + ' ' + username)
- }})
- bot.on('chat', (username, message) => {
- if (message === '$discord' && username === 'DuluthMN') {
- bot.chat('/w' + ' ' + username + "https://discord.gg/fqbm3qz")
- }})
- bot.on('chat', (username, message) => {
- if (message === '$commands' && username === 'DuluthMN') {
- bot.chat('> my commands are $tp00 $seed $owner $sleep $creator talk to DuluthMN for ideas of more commands')
- }})
- function sleep(delay) {
- var start = new Date().getTime();
- while (new Date().getTime() < start + delay);
- }
- let target = null
- bot.on('chat', (username, message) => {
- if (username === bot.username)
- target = bot.players[username].entity
- })
- function watchTarget () {
- if (!target) return
- bot.lookAt(target.position.offset(0, target.height, 0))
- }
- var elina;
- //var options2 = { host: 'constantiam.net',
- // port: 25565,
- // username: 'second username here (optional)',
- // password: 'second passowrd here (optional)',
- // verbose: true
- //}
- //elina = mineflayer.createBot(options2)
- //var lastmessage
- //var premessage
- //bot.on('chat', (username, message) => {
- // if (message !== premessage && username !== bot.username) {
- //sleep(500)
- //lastmessage = message
- //elina.chat('4b4t.us: [' + username + ']' + ' ' + message)
- //}})
- //elina.on('chat', (username, message) => {
- //if (message !== lastmessage && username !== bot.username) {
- //sleep(500)
- //premessage = message
- //bot.chat('Constantium.net: [' + username + ']' + ' ' + message)
- //}})
- var stdin = process.openStdin();
- stdin.addListener("data", function(d) {
- bot.chat(d.toString().trim());
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement