This is a toy project for sending discord message to a specific channel using channel id and bot token.
You first need to understand that discord bots are dependent to discord developer portal.
If you want to use bots, you'll need to register your application, make your bot and authorize it's intents, and invite the bot through oauth2 url link.
- Python 3.10.12
pip install -r requirements.txt
Basic log function is implemented inside functions.py; thus you'll only need to check app.log if needed.
- Configure bot information. You will need file named keys.json to specify token of bot, and channel id for bot to send message.
{
"TOKEN":"YOUR_BOT_TOKEN",
"CHANNEL_ID":"YOUR_SERVER_TEXT_CHANNEL_ID"
}
- Run bot. bot.py runs as independent server.
It will use port number 10080 by default.
nohup bot.py > bot.log 2>&1 &
- Run app.py with arguments. While session running bot.py is alive, run app.py to send message.
python app.py --message "Hello World!"
This will send message Hello World!
to your channel