tanishisherewithhh / ImperialsBot

Minecraft bot using mineflayer to chat spam, safeguard bases and many other utility functions. 3D display using prismarine viewer of the bot
MIT License
4 stars 2 forks source link

Realms support? #1

Closed dylanrobinett closed 4 months ago

dylanrobinett commented 5 months ago

I am going to try my best to modify the code to get this to work but I just don't know the code base well enough and I am sure its not going to work since the index.js run deep. also on 1.20.4

tanishisherewithhh commented 5 months ago

I found this on the mine-flayer docs.

Adding realms support would be pretty easy but as of now, ImperialsBot only supports cracked authentication. So you would need to change the authentication to premium as well.

P.S: ImperialsBot has a very dirty code. I essentially made this within a few hours for my friends. I tried improving it but it's better to rewrite from scratch using some bits of code. But if you still want, just change the bot creation code to this:

const client = mineflayer.createBot({
  username: 'email@example.com', // minecraft username
  realms: {
    // This function is called with an array of Realms the account can join. It should return the one it wants to join.
    pickRealm: (realms) => realms[0]
  },
  auth: 'microsoft'
})
dylanrobinett commented 5 months ago

I was able to get the bot up in my realm by adding similar code into index.js:

const main = () => { bot = mineflayer.createBot({ username: 'Microsoft Email Here', version: '1.20.4', auth: 'microsoft', realms: { pickRealm: (realms) => realms[0] }, });

I adjusted the config file accordingly as well. The only issue I have now is I don't really now how to use the bot lol.

tanishisherewithhh commented 4 months ago

Well, what do you intend to use the bot for? You can access the GUI interface for the bot via the localhost server, referring to Usage

Also make sure you have Node.js installed. Additional information is available on the readme.md file.

Keep in mind, this bot may not satisfy all your needs. There are better mineflayer bots available publicly with much better GUI and optimized code. It was also made mainly for anarchy servers (hence the chat spam and Kill aura). I doubt it will be much useful in your realms since it has no utility capabilities for the player.

dylanrobinett commented 4 months ago

My friends aren't very tech savvy and I just wanted to mess with them by being in the realm 24/7 doing random stuff and attacking them when they got close. Do you know of any good bots you could point me in the direction of?

tanishisherewithhh commented 4 months ago

If you are familiar with javascript, then you can code one yourself. It will only take up most of few minutes to get the bot running. All the docs are available on the mineflayer github, and for pvp, you can use the mineflayer-pvp plugin. The most basic way to do this would be to spawn a bot. Search for nearest player using the bot.players variable and use mineflayer-pvp to do its job.

I was not able to find a bot that is suitable for your task. Most bots online do not add realms by default or do not support PVP. You could also use ImperialsBot for your small prank since it can send chat messages, log them, kill players near you and also has 3D prismarine viewer support.

Also, in case you don't know, you have to keep your computer on for mineflayer bot to work, 24/7.