Berg János 6be84ba110
All checks were successful
Build docker image / build_docker_image (push) Successful in 1m8s
Build the "latest" docker image / build_docker_image (push) Successful in 13s
# Workflow manual trigger added.
2025-07-18 16:43:35 +02:00
2025-05-03 11:09:41 +02:00
2025-05-03 11:09:41 +02:00
2025-05-03 11:09:41 +02:00
2025-05-03 11:09:41 +02:00
2025-05-03 11:09:41 +02:00
2025-05-03 11:09:41 +02:00

Latest Testing

Proxima Discord bot

Proxima Discord Bot

Proxima is a Remainder Application, like many others, which primarily uses Discord to deliver the remainders to the user.

It provides an API interface to be embedded in other services, using Bearer Token Authentication.

The Discord bot provides basic functionality for convenience to the user as well.

This is the source code for the discord bot.

The bot allows the user to manage (add, edit, remove, list) its own remainders on the installed servers.

This bot is intended to be run as a docker container, see below.

For more details, see: Proxima -> Discord Bot

Main Technologies used

What is needed to run the bot

  • A working docker instance with compose.
  • A Discord account: Discord
  • A Discord application: Discord Developer Portal
  • A dedicated Discord server where the bot can send important notifications.

Running with Docker compose

Follow these easy steps to set up and your own bot:

NOTE: The program inside the container is running under a non-privileged user with

UID:1000 and GID:1000.

The storage folder must be writable for that user!

In the example, we just make it writable to everyone (please use proper access control instead!)

Or you can build your own image with different UID/GID values.

1. Create the directory structure (bash)

mkdir -p volumes/bot/{storage,env}

2. Update directory permissions to allow write access to the restricted docker user

This is for demonstration only, please use proper access control!

chmod o+w volumes/bot/storage

3. Create the .env file from src/.env.example file

wget -O volumes/bot/env/.env https://proxima.goliath.hu/proxima/discord-bot/raw/branch/main/src/.env.example

-OR-

curl -f -o volumes/bot/env/.env https://proxima.goliath.hu/proxima/discord-bot/raw/branch/main/src/.env.example

4. Customize the .env.config file

nano volumes/bot/env/.env

4.1 Fill in the bot application informations

  • Change the APPLICATION_ID for the discord bot application id.

    see: Discord Developer Portal

    <YOUR_APPLICATION> -> General Information -> Application ID

  • Change the PUBLIC_KEY for the discord bot public key.

    see: Discord Developer Portal

    <YOUR_APPLICATION> -> General Information -> Public Key

  • Change the TOKEN for the discord bot token.

    see: Discord Developer Portal

    <YOUR_APPLICATION> -> Bot -> Token

4.2 Fill in the bot home server informations

  • Change the HOME_SERVER_ID for dedicated discord server ID.

    see: Discord

    NOTE: This can be used to manage the bot.

  • Change the LOG_CHANNEL_ID for dedicated channel on the discord server.

    see: Discord

    NOTE: The system messages will be sent here.

4.3 Fill in the backend informations

  • Fill in the API_URL for backend api url.

    ex.: http://<your_backand_address>/api/v1/

    NOTE: If it runs on localhost, teh address is: http://backend:9000/api/v1/

4.3.1 Get the authentication token from the backend

  • Go visit the webpage backend /admin page and log in.

  • Go to the your Profile page.

    First step Second step

  • Here you can change your name, email, password at any time. hjfNdG68K2vbOrTn9bXVqDZBpNDER20rt5FRB1Sv2acd4353

  • Click on the Craete Token button, and create an access token for the Bot.

  • You can name the token anything you want.

  • Make sure you check all the Ablities checkboxes.

  • You can set an expire date if you want or leave empty (the token will not expire).

  • Press create and copy the new token and temporary save it. (If you lose it, you can always generate a new one, just delete the old now useless one).

4.3.2 Fill in the authentication token

  • Fill in the BACKEND_TOKEN for backend api token created by the 4.3.1 section.

5. Create the docker-compose.yaml file:

---
services:
  discord-bot:
    image: proxima.goliath.hu/proxima/discord-bot:latest
    container_name: bot
    volumes:
      - "./volumes/bot/env/.env:/app/Bot/.env:ro"
      - "./volumes/bot/storage:/app/Bot/Storage"
    restart: unless-stopped
    networks:
      - proxima

networks:
  proxima:
    external: true

NOTE: the external network is only neded if the backend and bot are on the same host, so they can communicate by the hostname.

You can create the network with the following command:

docker network create proxima

6 Start up service

docker compose up -d
Description
Sample PHP/ReaktPHP fullstack app.
https://proxima.goliath.hu/
Readme MIT 187 KiB
Languages
PHP 98.1%
Dockerfile 1%
Shell 0.9%