import requests
import json
def post(token, channel, content):
res = requests.post(
f"https://discordapp.com/api/channels/{channel}/messages",
json.dumps({'content' : content }),
headers={
"Authorization": f"Bot {token}",
"Content-Type": "application/json"
},
)
res=res.json()
return res['id']
def delete(token, channel, message):
res = requests.delete(
f"https://discordapp.com/api/channels/{channel}/messages/{message}",
headers={
"Authorization": f"Bot {token}"
},
)
print(res.text)
def update(token, channel, message, content):
res = requests.patch(
f"https://discordapp.com/api/channels/{channel}/messages/{message}",
json.dumps({'content' : content }),
headers={
"Authorization": f"Bot {token}",
"Content-Type": "application/json"
},
)
print(res)