From c37d1c9a0d53d2f6dc2d5aadede33fc335ae42e1 Mon Sep 17 00:00:00 2001 From: YTFort <100344180+YTFort@users.noreply.github.com> Date: Thu, 24 Feb 2022 11:48:49 +0300 Subject: [PATCH] Add files via upload --- Python/bot.py | 101 ++++++++++++++++++++++++++++++++++++++++++++++ Python/config.ini | 5 +++ 2 files changed, 106 insertions(+) create mode 100644 Python/bot.py create mode 100644 Python/config.ini diff --git a/Python/bot.py b/Python/bot.py new file mode 100644 index 0000000..e93b8ca --- /dev/null +++ b/Python/bot.py @@ -0,0 +1,101 @@ +from tkinter import RIGHT, Label, Entry, Tk, Button +from javascript import require, On +mineflayer = require('mineflayer') +from configparser import ConfigParser +import threading, os, webbrowser +config = ConfigParser() +config.read('config.ini') + +def getInputBoxValue(): + userInput = host.get() + return userInput + +def getInputBoxValue(): + userInput = port.get() + return userInput + +def getInputBoxValue(): + userInput = nick.get() + return userInput + +def startbot(): + bot = mineflayer.createBot({ + 'host': f'{host.get()}', + 'port': port.get(), + 'username': f'{nick.get()}' + }) + @On(bot, "login") + def login(this): + bot.chat(config.get('command', 'commandjoin')) + @On(bot, "error") + def error(err, *a): + print("Connect ERROR", err, a) + @On(bot, "kicked") + def kicked(this, reason, *a): + print("I was kicked", reason, a) + print('reconnect'); startbot() + @On(bot, "chat") + def handle(this, username, message, *args): + if username == bot.username: + return + elif message.startswith(config.get('command', 'pos')): + say_position(username) + elif message.startswith(config.get('command', 'aatrue')): + bot.chat('AntiAFK start') + bot.setControlState('forward', True) + bot.setControlState('jump', True) + bot.setControlState('sprint', True) + elif message.startswith(config.get('command', 'aafalse')): + bot.chat('AntiAFK stop') + bot.clearControlStates() + @On(bot, "spawn") + def spawn(this): + bot.chat("Spawned") + @On(bot, "death") + def death(this): + bot.chat("I died, respawn") + def say_position(username): + p = bot.entity.position + bot.chat(f"I am at {p.toString()}") + +def stopb(): + os.system('taskkill /f /im node.exe') + strtb.join() + bb.configure(text = "start", command=startb) +strtb=threading.Thread(target=startbot) +def startb(): + strtb.start() + bb.configure(text = "stop", command=stopb) + +def updt(): + webbrowser.open('https://discord.gg/bjgpVAxgyE') + +root = Tk() + +root.geometry('293x123') +root.configure(background='#F0F8FF') +root.title('24 Aternos | By FORTCOTE') + +host=Entry(root) +host.place(x=5, y=8) + +port=Entry(root) +port.place(x=5, y=33) + +nick=Entry(root) +nick.place(x=5, y=58) + +Label(root, text='ip', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=138, y=4) + +Label(root, text='ip port', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=138, y=30) + +Label(root, text='nickname', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=137, y=55) + +bb=Button(root, text='start', bg='#F0F8FF', font=('arial', 12, 'normal'), command=startb) +bb.pack(side=RIGHT, padx=20, pady=15) + +Button(root, text='update', bg='#F0F8FF', font=('arial', 12, 'normal'), command=updt).place(x=12, y=84) + +Label(root, text='Alpha 1.1', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=90, y=88) + +root.mainloop() diff --git a/Python/config.ini b/Python/config.ini new file mode 100644 index 0000000..ba5ebad --- /dev/null +++ b/Python/config.ini @@ -0,0 +1,5 @@ +[command] +commandjoin=/register 123123123 123123123 +pos=;pos +aatrue=;start +aafalse=;stop \ No newline at end of file