This repository is an open source project to demonstrate the usage of discord http interactions in python.
- This repo is open source and free to use.
- Http interactions can be used to host serverless bots, it saves us a lot of hosting resources and money.
You may also suggest changes by forking this repo and creating a pull request or opening an issue
- Clone this repo on your local machine
git clone https://github.com/0xhimangshu/discord-http-py
- Install the requirements
python -m pip install -U -r requirements.txt
- Create a discord application and bot on Discord Developer Portal
- Rename the example.config.py file to config.py
- Complete the config.py file with your bot token, application id and public key from the discord developer portal.
- Edit commands in commands.py
- Note: You will have to run upsert.py before main.py to upload your slash commands to discord.
- Run the bot
python main.py
- Sorry, you are not done yet! you have to use a server like ngrok to start a local webserver.
- Please install any server like ngrok and start a local webserver on port 3000.
ngrok http 3000
- Copy the https url from the ngrok terminal and paste it in the discord developer portal in the interaction section.
- You are done! Now you can use your bot in any server you want.
- This is serverless hosting so it wont cost you much 😉