我试图让所有用户都具有特定角色,但我不知道如何获得这个特定角色,我搜索并找到了
guild.get_role(ROLE_ID)
,但不起作用;-;
import discord
from discord.ext import commands
import os
TOKEN = # token
GUILD_ID = # guild id
ROLE_ID = # role id
bot = commands.Bot(command_prefix='+', intents=discord.Intents.all())
guild = bot.get_guild(GUILD_ID)
admin_role = guild.get_role(ROLE_ID)
bot.run(TOKEN)
错误:
AttributeError: 'NoneType' object has no attribute 'get_role'
我不知道如何解决帮助;-;