Skip to content

thegamecracks/thehttpbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thehttpbot

An interactions-over-HTTP discord bot using discord.py.

Outline

discord.py is mainly focused around discord's real-time gateway and doesn't support receiving interactions via HTTP. However, using the discord.py client's login() method, the bot can authenticate itself without establishing a gateway connection, allowing discord.py to send API requests. discord.py also has internal methods that allow manually dispatching interaction events within the library from JSON payloads. As such, the bot could simultaneously host a webserver using other libraries, in this case uvicorn and FastAPI, and then relay those interactions to discord.py.

Dependencies

This bot requires Python 3.11+ to run. In addition, dependencies must be configured using Poetry.

Usage

  1. Download the repository and navigate to the project root.

  2. Install the dependencies via Poetry (if you have not set up a virtual environment, Poetry will create one for you):

poetry install
  1. Copy the example.env file as .env and fill in the required credentials.

  2. Start the bot and webserver:

poetry run uvicorn thehttpbot:app --host 0.0.0.0 --port 5000 --env-file .env
  1. Use the invite link provided in the terminal to invite your bot.

License

This project uses the MIT license.

About

An HTTP-interactions discord bot using discord.py

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published