k8thekat / GatekeeperV2

Update to Gatekeeper
GNU General Public License v3.0
27 stars 11 forks source link
cubecoders

# Gatekeeper

Welcome to the efforts of countless hours of learning and failed attempts at writing code that culminated into this project known as Gatekeeper! Originally this started out as a bot to bring CubeCoders AMP to Discord with support for only Minecraft, but has evolved into this encompasing project of providing support for any type of server AMP can run along with providing as many of AMPs core features inside of Discord.

Need Support or have questions? Please visit my Discord and post in the respective channels. Come Join my Discord - Neko Neko Cafe

Features


Requirements


Setting up Python


Installing Python on Linux

A version of Python is installed on most Linux systems by default. It might not however include all the required packages.

For example, to install latest Python version available in the system repository, install:

`python3 python3-pip python3-venv`

Or for a specific version:

`python3.11 python3-pip python3.11-venv`

For RHEL or similar systems, consult your system documentation. An example might be:

`python39 python3-devel`

Installing Python on Windows

Installers can be downloaded from here.

  1. Run the installer as Administrator, and select “Customize installation”.
    • Make sure you select the option to install pip, and (under Advanced Options) the options to install Python for all users on the system and add it to the system’s environment variables.
    • Note - This will mean Python is installed in Program Files and is essential to ensuring it can be used by AMP.

Installing Python 3.12

Follow instructions listed above for your respective operating system.

  1. Open the requirements.txt and update numpy==1.25.1 -> numpy and yarl==1.9.2 -> yarl to no longer have version requirements.
    • Simply save the text file after the edit and restart.
    • Note - Any future updates may require this change again.

Creating a Discord Bot Account

  1. Please visit Creating a Bot Account
    • Use this Scope and Permissions -> Permissions
    • Enable the Intents Gatekeeper Needs -> Intents

Installation Methods


Manual Instructions

  1. Create an AMP user for the Bot with Super Admins role, must be done on the Global AMP Home Screen GUI.
    • Usually this is the URL ending in 8080 when connecting to AMP. (eg. http://X.X.X.X:8080)
    • Remember the Log-in details for your newly created AMP user.
  2. Follow the instructions in tokenstemplate.py file -> tokenstemplate.py
    • Rename tokenstemplate.py to tokens.py before you start.
  3. From Command Line run script start.py (eg. ../Discord Bot/start.py)
    • Run the bot, it will finish installing the rest of the requirements.
  4. See Interacting with the Bot~

AMP Instance Instructions

  1. Create an AMP user for the Bot with Super Admins role, must be done on the Global AMP Home Screen GUI.
    • Usually this is the URL ending in 8080 when connecting to AMP. (eg. http://X.X.X.X:8080)
  2. Create a new instance of GatekeeperV2 in a container. (The container option can be found under Configuration -> New Instance Defaults)
  3. Configure the settings in the GatekeeperV2 Instance under the Configuration -> Bot Settings, click Update, then start the bot.
  4. See Interacting with the Bot~

Interacting with the Bot

First Time Startup

Updating the Command Tree

Setting up a NON-Discord Adminstrator Role for the Bot

Setting your AMP Console Channels

Setting your AMP Chat Channels

Setting your AMP Event Channels

Setting your Whitelist Channel and Auto Whitelist Settings

Setting up your Server Banner Displays


Using Gatekeeperv2 as a Service

[Unit]
Description= GateKeeperv2
After= network.service

[Service]
Type= simple
WorkingDirectory= # This points to the directory of Gatekeeperv2 files (eg. '/home/gatekeeper')
ExecStart= #This points to the python3 script. (eg. 'ExecStart=/usr/bin/python3.9 /home/gatekeeper/start.py')
Restart= always 
RestartSec= 15

[Install]
WantedBy= multi-user.target

Then run these in the command line.

systemctl daemon-reload
systemctl enable gatekeeper.service
systemctl start gatekeeper.service

Useful Command

Thanks @LeviN


Credits

"Thank You" to everyone at CubeCoders Discord Server, especially IceofWrath, Mike, Greelan and everyone else in their discord.

"Thank You" to everyone over at Discord.py Discord Server, especially SolsticeShard and sgtlaggy for all the silly questions I kept asking about embed's and Hybrid messages!


Want to Support?

Visit my Patreon