Browse Month

August 2021

Simple Discord Messages in Python

This is a quick and easy way to send a bot message on Discord using Python, without the library, by simply doing a POST request with the requests library.

First you’ll need your bot’s token, which you can find from:

Next you’ll need the ID of the text channel where you want to send the messages to be sent. Simply right click the channel name and click “Copy ID”.

With those 2 values copied, paste them into the respective variables in the code below.

import requests

BOT_TOKEN = 'xxxxx'
CHANNEL_ID = '#####'

message = 'hello world!'
    json={'content': message},
        'authorization': 'Bot {}'.format(BOT_TOKEN),
        'content-type': 'application/json',

And that’s it! Execute the python script and check the Discord channel for the message!