Skip to main content

Discord Bot Library - UI & Image Manipulation for Making Games

Project description

Discord Bot Library - UI & Image Manipulation for Making Games Essentially just a wrapper over discord.py and Pillow to make life a little easier for image-based, and gameplay focused Discord bots. Provides:

  • Image creation with a UI system, and sprite management
  • Out-of-the-box persistent data management for players with extensibility
  • Various utilities for testing, and debugging to assist in development

Table of Contents

  1. Installation
  2. Troubleshooting
  3. Getting Help

Installation

Installing CordForge

pip install cordforge

Or install from source:

git clone https://github.com/Robert-DeForrest-Reynolds/CordForge
cd CordForge
pip install -e .

Create Your Bot Token

First, create a Discord application and bot at Discord Developer Portal.

Set Up Your Project

Create a Keys file in your project directory: key_name~your_discord_bot_token_here

dev_name=OTk3MDA...

Basic Bot Setup

bot.py

from CordForge import Cord

async def main_menu():
    """Your main dashboard function"""
    await Bot.New_Image()
    await Bot.Add_Button("Click Me!", button_callback, [])
    # Add more UI elements here

async def button_callback(interaction):
    """Handle button clicks"""
    await Bot.Reply(interaction)

# Create and start your bot
Bot = Cord("mybot", main_menu)
Bot.Start()

Launch Bot

cordforge bot_file.py token-key

cordforge bot.py dev_name

Next Steps

Now that you have a basic bot running, here are some ideas to expand it:

  1. Add more screens - Create different sections for your bot
  2. Use containers - Organize your UI with containers and borders
  3. Add images - Use ListItem with images for richer content
  4. Create games - Build simple games like tic-tac-toe or number guessing
  5. Add persistence - Save user data to files or databases

Version Control

Ensure your Keys file is hidden, here is a recommend .gitignore for example:

__pycache__
.venv
Keys
Data

Troubleshooting

Bot doesn't respond

  • Check that your bot token is correct in the Keys file
  • Make sure your bot is invited to the server with proper permissions
  • Verify the bot is online (check the console output)

Images don't appear

  • Always call await Bot.New_Image() before adding components
  • Make sure to call await Bot.Reply(interaction) to send the interface

Buttons don't work

  • Ensure your callback functions accept an interaction parameter
  • Check that you're calling await Bot.Reply(interaction) in your callbacks

Common Errors

  • "No image found": Call await Bot.New_Image() first
  • "Token not found": Check your Keys file format
  • "Invalid command": Make sure your bot prefix matches what you type

Getting Help

  • Look at the Examples for more complex use cases.
  • Review the API Reference for all available functionality.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cordforge-0.1.7.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cordforge-0.1.7-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file cordforge-0.1.7.tar.gz.

File metadata

  • Download URL: cordforge-0.1.7.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cordforge-0.1.7.tar.gz
Algorithm Hash digest
SHA256 4eba9045a61661b075920f2f24ce28427d52c3c58045af2586943431988ba54b
MD5 6ab5b18849a9b725254c70aa525672d9
BLAKE2b-256 86c40084ee52d825b6c96dc106d516d39ee20f5dfea50d0f4a99a5d9be37b0df

See more details on using hashes here.

File details

Details for the file cordforge-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: cordforge-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cordforge-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ae9d17ab9cd8187e51d1ef96fc3cc8a0eda2115d891f3c1c452ba3ee7f5d3964
MD5 0fbdddc3971dcc70ea20934505c07f82
BLAKE2b-256 925b0fb5948eaa539df74a8fcb0aae02fccf0eda31714cc46465e7d0ddf203a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page