diff --git a/apps.py b/apps.py index 2335a09..a2a116a 100644 --- a/apps.py +++ b/apps.py @@ -1,6 +1,4 @@ from django.apps import AppConfig -import subprocess -import sys import os path = os.path.dirname(os.path.abspath(__file__)) + "/assets/bots/geoffrey.py" @@ -13,7 +11,3 @@ class GeoffreyAppConfig(AppConfig): def ready(self): import GeoffreyApp.background_tasks as background_tasks background_tasks.run_tasks() - #subprocess.run('screen -X -S "{0}" quit'.format("geoffrey"), shell=True) - #subprocess.run( - # 'screen -S geoffrey -d -m {} {}'.format(sys.executable, path), - # shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/docs/source/bot_quickstart.rst b/docs/source/bot_quickstart.rst new file mode 100644 index 0000000..ca534e5 --- /dev/null +++ b/docs/source/bot_quickstart.rst @@ -0,0 +1,103 @@ +.. _bot_quickstart: + +Geoffrey Bot Quickstart +*********************** + +Geoffrey: A Discord Bot for Minecraft Servers +============================================= +Geoffrey was created to be an information source for base and shop locations on Minecraft severs. The bot mainly tracks +base, shop, and tunnel locations. This allows for users to quickly find each other's builds and find shops selling +goods. + +Geoffrey can be used on a Discord server or in a private message with the bot. + +Adding a base +------------- +First you must register with the bot if you are a new user:: + + ?register + +This allows Geoffrey to link your MC name with your Discord account. + +Then you can add your first base:: + +?add_base 500 550 + + +Your first base does not need a name, it defaults to "[Username]'s Base" + +If you want to specify a name:: + + ?add_base 500 550 My New Base + + +To delete a base:: + + ?delete "My Base" + +Adding a shop +------------- +A shop can be added like a base:: + + ?add_shop 500 550 + +or:: + + ?add_shop 500 550 Cool Shop + + +The following command then adds dirt to the shop with the price of 5 dirt for 1 diamond:: + + ?add_item Dirt 5 1 + +Then you could delete that entry by:: + + ?delete_item dirt + +To delete a shop:: + + ?delete "My shop" + + +If you have more than one shop, you need to specify the shop name. + +Searching in the database +------------------------- +The ``?find`` command is used to find bases and shops in Geoffrey. ``?find`` searches for both location names and owner names:: + + ?find ZeroHD + + +Then to find out more info about a location, use ``?info``:: + + ?info ZeroHD's Base + + + +``?selling`` can be used to find items for sale. Tip is better search for a subset of the item name +ig for `enderchests` search `ender`:: + + ?selling ender + + +You can also search around a position for locations with ``?find_around``:: + + ?find_around 0 0 + + +Editing Locations +----------------- +To rename a base/shop you can do the following (the quotations around the location names are important!):: + + ?edit_name "Cool New Name" "Current Name" + + +To move a location's position, use ``?edit_pos``:: + + ?edit_pos 420 69 Cool Base + + +To change the tunnel of a base, use ``?edit_tunnel``:: + + ?edit_tunnel North 545 + diff --git a/docs/source/conf.py b/docs/source/conf.py index a51e05d..186d831 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -27,7 +27,7 @@ copyright = '2019, ZeroHD' author = 'ZeroHD' # The short X.Y version -version = '' +version = '2.0' # The full version, including alpha/beta/rc tags release = '' diff --git a/docs/source/django_settings.rst b/docs/source/django_settings.rst new file mode 100644 index 0000000..5301263 --- /dev/null +++ b/docs/source/django_settings.rst @@ -0,0 +1,23 @@ +.. _django_settings: + +*************** +Django Settings +*************** + +Geoffrey App Settings +********************* +``GEOFFREY_NORTH_TUNNEL`` - North Nether tunnel name +``GEOFFREY_EAST_TUNNEL`` - East Nether tunnel name +``GEOFFREY_SOUTH_TUNNEL`` - South Nether tunnel name +``GEOFFREY_WEST_TUNNEL`` - West Nether tunnel name +``GEOFFREY_DYNMAP_BASE_URL`` - Dynmap URL +``GEOFFREY_DYNMAP_WORLD_NAME`` - Overworld name for dynmap +``GEOFFREY_MCM_API_TOKEN`` - Token for accessing the MCM API +``GEOFFREY_MCM_BASE_URL`` - MCM base link + +Geoffrey Discord Bot Settings +***************************** +``GEOFFREY_BOT_PREFIX`` - Discord bot prefix +``GEOFFREY_BOT_ERROR_USERS`` - List of Discord user IDs to send a PM on an error +``GEOFFREY_BOT_MOD_RANKS`` - List of Discord rank IDs to grant mod privileges to +``GEOFFREY_BOT_STATUS`` - Default bot playing stats \ No newline at end of file diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 62eb79f..7dcfdc9 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -1,103 +1,69 @@ .. _getting_started: -Getting Started with Geoffrey -***************************** +.. |br| raw:: html -Geoffrey: A Discord Bot for Minecraft Servers -============================================= -Geoffrey was created to be an information source for base and shop locations on Minecraft severs. The bot mainly tracks -base, shop, and tunnel locations. This allows for users to quickly find each other's builds and find shops selling -goods. +
-Geoffrey can be used on a Discord server or in a private message with the bot. +*************** +Getting Started +*************** -Adding a base -------------- -First you must register with the bot if you are a new user:: +Requirements +############# +Versions shown have been tested to work - ?register +* `Python 3.6.6`_ +* `Django 2.1.2`_ +* `Requests 2.20.0`_ +* `simplejson 3.16.0`_ -This allows Geoffrey to link your MC name with your Discord account. +.. _Python 3.6.6: https://www.python.org/ +.. _Django 2.1.2: https://pypi.org/project/Django/ +.. _Requests 2.20.0: https://pypi.org/project/requests2/ +.. _simplejson 3.16.0: https://pypi.org/project/simplejson/ -Then you can add your first base:: +Setup +##### +.. Note:: Geoffrey is a Django application. To install Geoffrey, you need to have a Django site already setup instructions to do that can be found `here`_ -?add_base 500 550 +.. _here: https://docs.djangoproject.com/en/2.2/intro/tutorial01/ +Clone Geoffrey +************** +In the Django project, clone import Geoffrey by cloning it +:: -Your first base does not need a name, it defaults to "[Username]'s Base" + git clone https://git.etztech.xyz/ZeroHD/Geoffrey.git GeoffreyApp -If you want to specify a name:: +Integrate Geoffrey Into The Django Project +****************************************** +In ``settings.py`` add ``GeoffreyApp`` to ``INSTALLED_APPS`` - ?add_base 500 550 My New Base +Once installed, run the migrations to setup the database for the first time +:: + python manage.py makemigrations + python manage.py migrate + +Then add the URLs to your projects's ``urls.py`` +:: + path('GeoffreyApp/', include('GeoffreyApp.urls')), + +Setup Settings +************** +To setup your ``settings.py`` for Geoffrey, checkout :ref:`django_settings` -To delete a base:: - ?delete "My Base" - -Adding a shop -------------- -A shop can be added like a base:: - - ?add_shop 500 550 - -or:: - - ?add_shop 500 550 Cool Shop - - -The following command then adds dirt to the shop with the price of 5 dirt for 1 diamond:: - - ?add_item Dirt 5 1 - -Then you could delete that entry by:: - - ?delete_item dirt - -To delete a shop:: - - ?delete "My shop" - - -If you have more than one shop, you need to specify the shop name. - -Searching in the database -------------------------- -The ``?find`` command is used to find bases and shops in Geoffrey. ``?find`` searches for both location names and owner names:: - - ?find ZeroHD - - -Then to find out more info about a location, use ``?info``:: - - ?info ZeroHD's Base -``?selling`` can be used to find items for sale. Tip is better search for a subset of the item name -ig for `enderchests` search `ender`:: - - ?selling ender -You can also search around a position for locations with ``?find_around``:: - - ?find_around 0 0 -Editing Locations ------------------ -To rename a base/shop you can do the following (the quotations around the location names are important!):: - - ?edit_name "Cool New Name" "Current Name" -To move a location's position, use ``?edit_pos``:: - - ?edit_pos 420 69 Cool Base -To change the tunnel of a base, use ``?edit_tunnel``:: - ?edit_tunnel North 545 diff --git a/docs/source/index.rst b/docs/source/index.rst index c6b6863..ef1b973 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -3,14 +3,15 @@ Geoffrey: Minecraft Server Info Database ======================================== -Geoffrey was created to be an information source for base and shop locations on Minecraft severs. The bot mainly tracks -base, shop, and tunnel locations. This allows for users to quickly find each other's builds and find shops selling -goods. +Geoffrey was created to be an information source for base and shop locations on Minecraft severs. Geoffrey can track +bases, shops, items for sale, tunnels, towns, public farms and more! .. toctree:: :maxdepth: 1 :caption: Contents: getting_started + django_settings commands models + bot_quickstart.rst diff --git a/urls.py b/urls.py index dac4671..77dc0c3 100644 --- a/urls.py +++ b/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import url +from django.urls import path, include from . import views urlpatterns = [ @@ -20,5 +21,6 @@ urlpatterns = [ url(r'^pointofinterest/$', views.PointOfInterestList.as_view(), name='GeoffreyPointOfInterest'), url(r'^pointofinterest/(?P[0-9]{1,9})/$', views.PointOfInterestInfo.as_view(), name='GeoffreyPointOfInterestInfo'), + path('api/', include('GeoffreyApp.api.urls')), ]