Skip to content

An open source project for demonstration of discord http interaction bot using python.

License

Notifications You must be signed in to change notification settings

Binacy/discord-http-interaction-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Discord http Interaction Bot

An awesome open source project to demonstrate usage of discord http interactions in python!
· Report Bug · Request Feature

About The Project

This repository is an open source project to demonstrate the usage of discord http interactions in python. There are many repos using discord gateway system to create bots, but this repo is different. This repo uses discord http interactions to create a bot. This is a very undiscovered feature of discord and is still underrated. This repo is created to demonstrate the usage of this feature.

Here's why:

  • There's no repo on github that demonstrates the usage of discord http interactions in python.
  • Everything in this repo is well documented and explained.
  • This repo is open source and free to use.
  • This repo is created to help people who are new to discord bots and want to learn how to create one.
  • Http interactions can be used to host serverless bots, it saves us a lot of hosting resources and money.

A great example is Dyno bot on discord which is using gateway and http interactions both simontaneously to save hosting resources and money. You can do the same, just with some knowledge of python, discord http interactions and some creativity.

Of course, no one will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue. Thanks to all the people have contributed to expanding this project!

(back to top)

Built With

(back to top)

Getting Started

  1. Clone this repo on your local machine
git clone https://github.com/Binacy/discord-http-interaction-bot
  1. Install the requirements (Sorry i use reqs instead of requirements)
pip3 install -U -r reqs.txt
  1. Create a discord application and bot on Discord Developer Portal
  2. Rename the example.env file to .env
  3. Complete the .env file with your bot token, application id and public key from the discord developer portal.
  4. Edit commands in commands.py
  • Note: You will have to run upsert.py before main.py to upload your slash commands to discord.
  1. Run the bot
python3 main.py
  1. Sorry, you are not done yet! you have to use a server like ngrok to start a local webserver.
  2. Please install any server like ngrok and start a local webserver on port 3000.
ngrok http 3000
  1. Copy the https url from the ngrok terminal and paste it in the discord developer portal in the interaction section.
  2. You are done! Now you can use your bot in any server you want.
  3. Ah! not done yet, You can use web services like vercel to host your bot 24/7 for free. You can also use heroku.
  4. This is serverless hosting so it wont cost you much 😉

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Discord - @Binacy

(back to top)

Acknowledgments

Special thanks to Aditya and Amey for helping me with this project.

(back to top)

About

An open source project for demonstration of discord http interaction bot using python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages