FAZuH / faz-bot-discord

Wynncraft utility and statistics discord bot.
MIT License
1 stars 0 forks source link
discord-bot wynn wynncraft

faz-bot

Wynncraft utility and statistics discord bot. Inspired by motoki317's .

[!WARNING] This repository is currently in development phase, and may undergo many unstable and/or breaking changes.

Development

Some useful shortcuts for development are written in Makefile.

For debugging:

Actions:

Access your SQL database remotely through SSH by forwarding the remote port to a local port on your machine:

# Accessing database using phpMyAdmin on localhost:8080
ssh -L 8080:localhost:8080 user@remote-ip

# Accessing database using mariadb/mysql client on localhost:3306
ssh -L 3306:localhost:3306 user@remote-ip

Installation

You can either manually build and install the bot, or pull image from the release. Using docker might be easier but overheads could be a problem.

Dependencies:

  1. Clone the repository:
git clone https://github.com/FAZuH/faz-bot.git

cd faz-bot
  1. Run make init
  2. Fill in the .env file with your own values.

[!NOTE] You can override python executable by setting PYTHON when calling make commands. e.g., make init PYTHON=python3.13

Docker Installation

  1. Run make sql act=up wait-for-mysql initdb up-all to pull, initialize, and start the service in one go.

After installing, you can just do step 5 to start all services.

Manual Installation

  1. Export the environment variables: source .env
  2. Run make initdb to initialize the database.
  3. Run source .venv/bin/activate to activate the virtual environment.
  4. Run the service: python -m <module-path>

After running all the above, you just need to do step 4, 6 and 7 to start the service.

[!NOTE]

  • Argument for step 7 is the module path to the main.py file of the service you want to run. e.g., fazbeat.fazcollect
  • Currently database version checking is not supported on manual installation. You just have to read the error.

Changing Database Versions

To upgrade or downgrade the database version, you can use alembic to manage the database migrations. Make sure you have it installed by running pip install alembic.

  1. View revision GUIDs with python -m alembic --name <db-name> history
  2. Select the revision you want to checkout into python -m alembic --name <db-name> upgrade <revision>

Alternatively, you can upgrade straight to the latest revision by running python -m alembic --name <db-name> upgrade head.

[!WARNING]

  • It is recommended to backup your database before upgrading/downgrading.
  • Downgrading might result in data loss.

Credits