我正在为我的discord服务器编写机器人,我想向第一次加入服务器的任何人发送自动直接消息。我查看了文档,但我找不到任何有关如何执行此操作的信息。我使用的是python 3.5和discord.py版本0.16.12。
答案 0 :(得分:1)
如果您使用不和谐的py重写,这应该可以工作
确保已如图所示启用了机器人的意图
intents=discord.Intents.all()
client = commands.Bot(command_prefix= cmd,intents=intents)
@client.event
async def on_member_join(member):
await member.send(f"your welcome message here")
答案 1 :(得分:0)
https://discordpy.readthedocs.io/en/latest/api.html#discord.on_member_join
您可以采取以下措施:
await bot.send_message(member, "hello")