Skip to content

This API enables you to trigger a bot sending messages to a Discord channel by sending requests to a website.

License

Notifications You must be signed in to change notification settings

ColdIV/discord-bot-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API

Use at your own risk.

This was a project where I tried to control a discord bot via a webinterface. It somewhat worked but is not secure and for my use case discord webhooks where sufficient so I stopped working on this.


Requires Python 3.7 or higher!

Which means you may have to compile Python yourself on RaspbianOS

This API enables you to trigger a bot sending messages to a Discord channel by sending a request to a website.

Setup

git clone https://github.com/ColdIV/discord-bot-api
cd discord-bot-api
virtualenv env

Linux

source env/bin/activate

Windows

.\env\Scripts\activate

Install requirements

pip3 install -r requirements.txt

Add tokens and channel id

Rename .config.example to .config and fill in the tokens and channel id.

You should then have a file that looks something like this:

[api]
TOKEN=EXAMPLE_API_TOKEN

[discord]
TOKEN=EXAMPLE_DISCORD_BOT_TOKEN
CHANNEL_ID=EXAMPLE_DISCORD_CHANNEL_ID

Run dev

python3 api.py

Run prod

Note: This program has never been tested properly in an production environment. Use at own risk!

hypercorn api:app

Usage

Send a request like this:

https://api.example.com/?token=EXAMPLE_API_TOKEN&message=EXAMPLE_MESSAGE

The tokens should, of course, never be published. :)

About

This API enables you to trigger a bot sending messages to a Discord channel by sending requests to a website.

Topics

Resources

License

Stars

Watchers

Forks

Languages