Compare commits
	
		
			3 Commits
		
	
	
		
			6315f8c309
			...
			3c31c41acd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3c31c41acd | |||
| 15d4dd7922 | |||
| 8f0d2eb417 | 
							
								
								
									
										18
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								main.py
									
									
									
									
									
								
							@@ -91,14 +91,22 @@ def main():
 | 
				
			|||||||
        observer.stop()
 | 
					        observer.stop()
 | 
				
			||||||
    observer.join()
 | 
					    observer.join()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def run_api():
 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    host = '0.0.0.0'
 | 
					    host = '0.0.0.0'
 | 
				
			||||||
    port = 3300
 | 
					    port = 3300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    threading.Thread(target=app.run, kwargs={'host': host, 'port': port}).start()
 | 
					    while True:
 | 
				
			||||||
    print('Web interface listening on port:', port)
 | 
					        print('Trying to run web interface on port:', port)
 | 
				
			||||||
    print('Try going to http://localhost:' + str(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)
 | 
					    time.sleep(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    main()
 | 
					    main()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -272,6 +272,12 @@ def bot(global_state):
 | 
				
			|||||||
        elif EMAIL:
 | 
					        elif EMAIL:
 | 
				
			||||||
            print('No password provided, attempting to connect in offline mode...')
 | 
					            print('No password provided, attempting to connect in offline mode...')
 | 
				
			||||||
            g.connection = Connection(SERVER, PORT, username=EMAIL)
 | 
					            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:
 | 
					        else:
 | 
				
			||||||
            print('No username or password provided, using burner minecraft account...')
 | 
					            print('No username or password provided, using burner minecraft account...')
 | 
				
			||||||
            EMAIL = 'moc.liamg@monortem'[::-1]
 | 
					            EMAIL = 'moc.liamg@monortem'[::-1]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,6 +50,9 @@ class Commands:
 | 
				
			|||||||
        if prefix == bot_num:
 | 
					        if prefix == bot_num:
 | 
				
			||||||
            for_me = True
 | 
					            for_me = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if data.startswith('[') and data.endswith(']'):
 | 
				
			||||||
 | 
					            command = 'nosquarebrackets'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -81,6 +84,9 @@ class Commands:
 | 
				
			|||||||
            if command == 'echo' and data:
 | 
					            if command == 'echo' and data:
 | 
				
			||||||
                reply = data
 | 
					                reply = data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if command == 'nosquarebrackets':
 | 
				
			||||||
 | 
					                reply = 'don\'t literally put the [ ]'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ## !pos - replies with position and dimension
 | 
					            ## !pos - replies with position and dimension
 | 
				
			||||||
            if command == 'pos':
 | 
					            if command == 'pos':
 | 
				
			||||||
                reply = str(utils.pint(self.g.pos))[1:-1] + ', ' + self.g.dimension
 | 
					                reply = str(utils.pint(self.g.pos))[1:-1] + ', ' + self.g.dimension
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user