【发布时间】:2021-03-31 13:36:03
【问题描述】:
所以,我正在为我所在的服务器制作一个机器人,当你加入它时,它会给你一个未经验证的角色。所有者已与 Carl-Bot 建立了验证反应,我想知道如何让我的机器人在用户验证时删除未验证的角色?
我的代码:
@client.event
async def on_member_join(member):
try:
role = discord.utils.get(member.guild.roles, name="Unverified")
await member.add_roles(role)
print(f"{member} has joined")
verify = member.guild.get_channel(772263419210235916)
rules = member.guild.get_channel(772995392521895937)
channel = client.get_channel(772583213797212211)
embed=discord.Embed(title="Welcome to Delight Stuidos!",
description=f"{member.mention} has joined! \nDon't forget to read the {rules.mention}, and react with the purple star in {verify.mention}!\n Enjoy your stay ^^",
color = discord.Colour.orange())
embed.set_thumbnail(
url=member.avatar_url
)
await channel.send(embed=embed)
e = discord.Embed(title="Welcome to DS!",
description=f"""Be sure read the {rules.mention}\nand to verify with the purple heart in {verify.mention}!
If you have any questions, feel free to DM the mods and/or owner of the server!""",
color=discord.Colour.orange())
await member.send(embed=e)
except Exception as e:
print(e)
谢谢!
【问题讨论】:
标签: python discord discord.py