【问题标题】:Python does not detect "on_member_join"Python 未检测到“on_member_join”
【发布时间】:2021-05-04 10:23:41
【问题描述】:
Bot = discord.Client()
token = open('token.txt', 'r').read()
@Bot.event
async def on_member_join(member):
    print(f"{member} has joined the server")

client.run(token)

“on_message”正常工作,但“on_member_join”不起作用。

【问题讨论】:

标签: python python-3.x discord.py


【解决方案1】:

与成员相关的事件需要在开发者门户中启用特殊的member intents ,并在您的代码中进行定义。

intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix='Prefix', intents=intents)

【讨论】:

    猜你喜欢
    • 2020-08-09
    • 2018-11-05
    • 1970-01-01
    • 1970-01-01
    • 2022-08-06
    • 2021-08-20
    • 2022-01-21
    • 2021-02-07
    • 1970-01-01
    相关资源
    最近更新 更多