【问题标题】:My on_member_join isn't sending the welcome message我的 on_member_join 没有发送欢迎消息
【发布时间】:2021-03-28 06:56:20
【问题描述】:

所以,我正在为我所在的服务器制作一个机器人,并尝试在成员加入时添加欢迎消息。到目前为止,它一直没有工作,也没有给出错误。有什么问题吗?

async def on_member_join(member):
    print("working") #I have this here to check to see if its being called, but no message is printed.
    rules = client.get_channel(772263419210235916)
    verify = client.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}!
                        Enjoy your stay ^^""",
                        color = discord.Colour.orange())
    embed.set_thumbnail(url=f"https://i.ibb.co/NC2Wgnk/DS.png")
    await channel.send(embed=embed)

也启用了意图,所以我不知道发生了什么。

【问题讨论】:

  • 您是否启用了intents.members
  • 是的,我启用了它们

标签: python discord discord.py


【解决方案1】:

更改了一些可能导致错误的内容

async def on_member_join(member):
    try:
        print("working") #I have this here to check to see if its being called, but no message is printed.
        rules = member.guild.get_channel(772263419210235916)
        verify =  member.guild.get_channel(772995392521895937)
        channel =  member.guild.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="https://i.ibb.co/NC2Wgnk/DS.png")
        await channel.send(embed=embed)
    except Exception as e:
        print(e)

【讨论】:

  • 啊,那也没用——它没有发送 e 或打印任何东西
  • @Wackamole 可能会尝试摆脱 .set_thumbnail 并尝试因为没有生成错误
猜你喜欢
  • 2021-10-05
  • 1970-01-01
  • 2021-10-07
  • 2021-08-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-09
  • 1970-01-01
相关资源
最近更新 更多