diff --git a/README.md b/README.md index 7c78932..88075fb 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ A map-based social gardening - `./setup_packages.sh` - install ubuntu system package requierments -- `./setup_venv.sh` - prepares the virtual environemnt using kivy 1.11.1 with python 3.6 -- `./setup_venv.sh pre` - prepares the virtual environment using kivy 2.0.0rc3 with python 3.8 +- `./setup_venv.sh` - prepares the virtual environment using kivy 2.0.0rc3 with python 3.8 (ubuntu 20.04) - `python3 populatedb.py trees.kml` diff --git a/buildozer.spec b/buildozer.spec index 36b4130..05eaab8 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -36,11 +36,12 @@ version = 0.1 # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy -requirements = python3,requests,certifi,urllib3,chardet,idna,sqlite3,kivy,mapview +requirements = python3,setuptools,requests,certifi,urllib3,chardet,idna,sqlite3,Kivy==2.0.0rc4,mapview,pydle # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes # requirements.source.kivy = ../../kivy +##requirements.source.kivy = ../../kivy # (list) Garden requirements #garden_requirements = diff --git a/cncbot.py b/cncbot.py index 1067c85..d8d6119 100644 --- a/cncbot.py +++ b/cncbot.py @@ -2,7 +2,7 @@ import pydle import random import string -CNC_HOST='dark.deflax.net' +CNC_HOST='forest.deflax.net' ADMIN_NICKNAMES = [ 'afx' ] def get_random_string(length): @@ -34,17 +34,25 @@ class ForestBot(pydle.Client): async def on_message(self, target, source, message): await super().on_message(target, source, message) + + # Print Help + if message.startswith('!help {}'.format(target)): + await self.message(target, '] CnC globalforest__armeabi-v7a-debug-0.1 ') + await self.message(target, '!id - cnc user info' # Tell a user if they are an administrator for this bot. - if message.startswith('!stats'): + if message.startswith('!id {}'.format(target)): admin = await self.is_admin(source) if admin: - await self.message(target, '{}: You are an administrator.'.format(source)) + await self.message(target, 'You are an administrator. :)'.format(source)) else: - await self.message(target, '{}: You are not an administrator.'.format(source)) + await self.message(target, 'You are NOT an administrator. :('.format(source)) -if __name__ == '__main__': +def CnCApp(): cnc = ForestBot('client_' + get_random_string(5)) cnc.run(CNC_HOST, tls=False, tls_verify=False) + +if __name__ == '__main__': + CnCApp() \ No newline at end of file diff --git a/main.py b/main.py index 32edf27..281c2d1 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ # Import system modules -#import trio -import asyncio +import multiprocessing import random import sqlite3 @@ -24,6 +23,7 @@ from forestmapview import ForestMapView from gpshelper import GpsHelper from settings import SampleBoxLayout from game import GameWidget +from cncbot import CnCApp # Welcome message MOTD = """] @@ -80,22 +80,16 @@ class MainApp(MDApp): # Instantiate SearchPopupMenu #self.search_menu = SearchPopupMenu() - + if __name__ == '__main__': - #asyncio.run(MainLoop()) - #screen_manager = ScreenManager() - #screen_manager.add_widget(ScreenOne(name="screen_one")) - #screen_manager.add_widget(ScreenTwo(name="screen_two")) + # Start the Command and Control bot. Mainly for reporting. + cnc = multiprocessing.Process(target=CnCApp) + cnc.start() + # Start the Kivy Framework main loop kivyapp = MainApp() kivyapp.run() - #cnc = ForestBot('client_' + get_random_string(5)) - #loop = asyncio.get_event_loop() - #loop.create_task( - # cnc.run(CNC_HOST, tls=False, tls_verify=False) - #) - #loop.run_until_complete( - # kivyapp.async_run() - #) - #loop.close() \ No newline at end of file + # Cleanup subprocesses + print('] Terminating cnc.') + cnc.kill() \ No newline at end of file