【问题标题】:discord bot Welcome message dont work .py不和谐机器人欢迎消息不起作用.py
【发布时间】:2021-04-27 01:57:17
【问题描述】:
class Welcome (commands.Cog, name="join"):

    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self, member: discord.Member):
        role = discord.utils.get(member.guild.roles, name='Server Tag')
        channel = self.bot.get_channel(801949269165998080)
        embed = discord.Embed(description=f'Hi {member.mention}, Welcome to the server', color=0x0bf9f9)
        await member.add_roles(role)
        await channel.send(embed=embed)

当成员加入服务器时,机器人不会回复消息。可能是什么问题?

【问题讨论】:

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


【解决方案1】:

问题可能是您没有启用intents,您可以根据需要在机器人上启用意图here.

您确实需要编写一些代码来启用意图,但我觉得这很容易。

这是我需要编写的代码,以使我的意图发挥作用。 ^^^

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-12
    • 2021-05-09
    • 2022-01-18
    • 2021-04-08
    • 2021-08-17
    • 1970-01-01
    • 2020-05-18
    • 2021-09-26
    相关资源
    最近更新 更多