2020-09-10 21:33:52 +00:00
|
|
|
# Minecraft Bot
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
Assuming Debian / Ubuntu based distro:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ sudo apt update
|
2021-02-21 00:08:14 +00:00
|
|
|
$ sudo apt install build-essential python3 python3-dev python3-pip python3-virtualenv git
|
2020-12-15 22:37:32 +00:00
|
|
|
|
2021-01-05 06:15:12 +00:00
|
|
|
$ git clone https://git.tannercollin.com/tanner/minecraft-bot.git
|
|
|
|
$ cd minecraft-bot/
|
2020-12-15 22:37:32 +00:00
|
|
|
$ bash download_mcdata.sh
|
2020-09-10 21:33:52 +00:00
|
|
|
$ virtualenv -p python3 env
|
|
|
|
$ source env/bin/activate
|
|
|
|
(env) $ pip install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
Always make sure the virtual environment is running `(env)`.
|
|
|
|
|
|
|
|
## Running
|
|
|
|
|
|
|
|
```
|
|
|
|
(env) $ USERNAME=you@domain.com PASSWORD=supersecret SERVER=example.com python main.py
|
|
|
|
```
|
|
|
|
|
2021-03-26 22:18:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Commands
|
|
|
|
|
|
|
|
Talking to bot (All commands can be found in "game.py" under "public commands", starting around line 494)
|
|
|
|
|
|
|
|
Use prefix (in this case, "1") to call to attention before giving command. (EX. 1ping, 1here, etc.)
|
|
|
|
|
|
|
|
# ping
|
|
|
|
Will respond "pong" if active and listening
|
|
|
|
|
|
|
|
# pos
|
|
|
|
Will respond with current position
|
|
|
|
|
|
|
|
# afk
|
|
|
|
Will afk (if not already)
|
|
|
|
|
|
|
|
# unafk
|
|
|
|
Will unafk (if afk)
|
|
|
|
|
|
|
|
# error
|
|
|
|
---
|
|
|
|
|
|
|
|
# inv
|
|
|
|
Will list inventory (in terminal)
|
|
|
|
|
|
|
|
|
|
|
|
# time
|
|
|
|
---
|
|
|
|
|
|
|
|
# count
|
|
|
|
---
|
|
|
|
|
|
|
|
# loaded
|
|
|
|
---
|
|
|
|
|
|
|
|
# players
|
|
|
|
---
|
|
|
|
|
|
|
|
# objects
|
|
|
|
---
|
|
|
|
|
|
|
|
# mobs
|
|
|
|
---
|
|
|
|
|
|
|
|
# monsters
|
|
|
|
---
|
|
|
|
|
|
|
|
# villagers
|
|
|
|
---
|
|
|
|
|
|
|
|
# threats
|
|
|
|
---
|
|
|
|
|
|
|
|
# spiral
|
|
|
|
---
|
|
|
|
|
|
|
|
# sand slice
|
|
|
|
---
|
|
|
|
|
|
|
|
# zzz
|
|
|
|
Will afk if in overworld, and if not already afk
|
|
|
|
|
|
|
|
# tree
|
|
|
|
---
|
|
|
|
|
|
|
|
# block
|
|
|
|
---
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## temporary workarounds
|
|
|
|
|
|
|
|
# Add "?" to line 457, which is "match1 = re.match(r'<(\w+)> (.*)', text)"
|
|
|
|
It should now look like this "match1 = re.match(r'<?(\w+)> (.*)', text)"
|
|
|
|
This allows the bot to react to commands made by someone else than the creator of code (Tanner6)
|
|
|
|
|
|
|
|
|