【发布时间】:2021-06-30 21:49:58
【问题描述】:
我正在为我的服务器制作一个机器人,我希望它自动为刚加入的成员分配一个角色。我在谷歌上四处寻找答案,它说要使用意图。我使用了它们,甚至在开发门户中搞砸了,但它仍然无法正常工作。
import discord
from discord.utils import get
bot = discord.Client(intents=intents)
bot = commands.Bot(command_prefix="!")
Default_Role = 'Starineer'
@bot.event
async def on_member_join(member):
role = get(member.guild.roles, name=Default_Role)
await member.add_roles(role)
(如果我将 bot = discord.Client(intents=intents) 更改为 client = discord.Client(intents=intents),我将无法使用的命令)
【问题讨论】:
-
你为什么使用
discord.Client和commands.bot?
标签: discord.py