I'm trying to make a discord bot in python and I want to figure out how to give a role to myself, without notifying anything besides a conformation in the console.
import discord
import os
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == '':
# i want to give myself a role right here
print('adding admin role to', message.author)
print(message.author,message.content)
try:
client.run(os.getenv("TOKEN"))
except discord.HTTPException as e:
if e.status == 429:
print("The Discord servers denied the connection for making too many requests")
print("Get help from https://stackguides.com/questions/66724687/in-discord-py-how-to-solve-the-error-for-toomanyrequests")
else:
raise e