I am creating a discord bot to change its own role. Currently I am just trying to give it a role.
import json
import discord
import os
import bs4
from dotenv import load_dotenv
from discord.ext import commands
from datetime import datetime
import time
import re
from string import digits, ascii_letters
from discord.ext.commands import Bot
import aiohttp
from discord.utils import get
load_dotenv()
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
bot = commands.Bot(command_prefix="$")
bot.remove_command('help')
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
url = "hidden"
@bot.event
async def on_ready():
await bot.wait_until_ready()
bot.session = aiohttp.ClientSession()
print("It's ready - fetching btc price")
while True:
async with bot.session.get(url) as resp:
resp = await resp.text()
auth = [MY BOTS ID]
role = [ROLE ID, I.E 9234824234626534]
await bot.add_roles(auth, role)
error AttributeError: 'Bot' object has no attribute 'add_roles'
How can I give my bot a role or remove a role? It must be in def on_ready()