Skip to content

How to get the bot working

Iván Pérez edited this page Apr 30, 2025 · 5 revisions

Getting Ui-Py Up and Running

There are multiple ways to deploy Ui-Py. This guide covers the recommended methods in order of preference:

  1. Using GitHub Container Registry (ghcr.io) - The easiest method
  2. Using Docker Compose - Simple local deployment
  3. Using Pipenv - For development or non-containerized environments

Prerequisites

Before starting with any method, you need to:

  1. Create a Discord Bot Application:

    • Go to the Discord Developer Portal
    • Click "New Application" and follow the prompts
    • Navigate to the "Bot" tab and click "Add Bot"
    • Under the "Privileged Gateway Intents" section, enable "Message Content Intent"
    • Copy your bot token (you'll need this later)
  2. Invite the bot to your server:

    • In the Developer Portal, go to OAuth2 > URL Generator
    • Select "bot" and "applications.commands" scopes
    • Select the permissions your bot needs (recommended: "Send Messages", "Use Slash Commands", "Manage Messages")
    • Copy the generated URL, paste it in your browser, and add the bot to your server

Using GitHub Container Registry

The simplest way to get the bot running is to use the pre-built Docker image from GitHub Container Registry:

# Pull the image
docker pull ghcr.io/taichikuji/ui-py:latest

# Run the container with your bot token
docker run -e TOKEN="YOUR_BOT_TOKEN" ghcr.io/taichikuji/ui-py:latest

Using Docker Compose

For local deployment with Docker Compose:

  1. Clone the repository:

    git clone https://github.com/taichikuji/Ui-Py.git
    cd Ui-Py
  2. Set your bot token as an environment variable:

    export TOKEN='YOUR_BOT_TOKEN_HERE'
  3. Deploy with the script:

    ./deploy-dc.sh

This script will:

  • Stop any previous instances of the bot
  • Pull the latest code from the repository
  • Build the Docker image
  • Start the bot container

Running Directly with Pipenv

For development or non-containerized environments:

  1. Clone the repository:

    git clone https://github.com/taichikuji/Ui-Py.git
    cd Ui-Py
  2. Ensure you have the correct Python version installed (see Pipfile):

    # Currently requires Python 3.12
    pyenv install 3.12
    pyenv local 3.12
  3. Install dependencies:

    pip install pipenv
    pipenv sync
  4. Run the bot:

    export TOKEN='YOUR_BOT_TOKEN_HERE'
    pipenv run python main.py

Troubleshooting

  • Bot not responding? Check if you enabled the "Message Content Intent" in the Discord Developer Portal.
  • Import errors? Make sure you've installed all dependencies with pipenv sync.
  • Permission errors with Docker? Try running the commands with sudo.
  • Connection issues? Check your internet connection and verify that your bot token is correct.

Need more help? Create an issue on GitHub.

Clone this wiki locally