【问题标题】:How do i fix this autorole?我该如何修复这个自动角色?
【发布时间】:2021-08-03 12:23:32
【问题描述】:

嘿,当有人加入时,我尝试制作自动角色,但我不知道穿了什么

async def on_member_join(member):
   guild = client.get_guild(837586432003407872)
   role = guild.get_role(842049118917885973)   
   await member.add_roles(role)```

【问题讨论】:

标签: python discord discord.py


【解决方案1】:

我前段时间遇到过这个问题。解决方案:

  1. 首先在discord developers 站点的Bot 选项卡中启用服务器成员意图。图片:

  1. 将此代码添加到您的代码中:
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix="your prefix", intents=intents)
#put bot at the beggining if you are using bot as a variable
  1. 享受工作代码

【讨论】:

  • 非常感谢:D
猜你喜欢
  • 2022-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-13
  • 1970-01-01
  • 1970-01-01
  • 2013-05-31
  • 2016-02-24
相关资源
最近更新 更多