Compare commits

...

3 Commits

  1. 18
      main.py
  2. 6
      mosfet/bot.py
  3. 6
      mosfet/commands.py

@ -91,14 +91,22 @@ def main():
observer.stop()
observer.join()
if __name__ == '__main__':
def run_api():
host = '0.0.0.0'
port = 3300
threading.Thread(target=app.run, kwargs={'host': host, 'port': port}).start()
print('Web interface listening on port:', port)
print('Try going to http://localhost:' + str(port))
while True:
print('Trying to run web interface on port:', port)
print('If it works, go to http://localhost:' + str(port))
try:
app.run(host=host, port=port)
except OSError:
print()
print('Error: Port already taken.')
port += 1
if __name__ == '__main__':
threading.Thread(target=run_api).start()
time.sleep(1)
main()

@ -272,6 +272,12 @@ def bot(global_state):
elif EMAIL:
print('No password provided, attempting to connect in offline mode...')
g.connection = Connection(SERVER, PORT, username=EMAIL)
elif PASSWORD:
print('')
print('Did you forget to specify an email?')
print('If you want to use your own account:')
print('EMAIL=you@domain.com PASSWORD=supersecret SERVER=minecraft.example.com ./run_linux.sh')
os._exit(0)
else:
print('No username or password provided, using burner minecraft account...')
EMAIL = 'moc.liamg@monortem'[::-1]

@ -50,6 +50,9 @@ class Commands:
if prefix == bot_num:
for_me = True
if data.startswith('[') and data.endswith(']'):
command = 'nosquarebrackets'
try:
@ -81,6 +84,9 @@ class Commands:
if command == 'echo' and data:
reply = data
if command == 'nosquarebrackets':
reply = 'don\'t literally put the [ ]'
## !pos - replies with position and dimension
if command == 'pos':
reply = str(utils.pint(self.g.pos))[1:-1] + ', ' + self.g.dimension

Loading…
Cancel
Save