【发布时间】:2021-04-08 00:55:26
【问题描述】:
我是使用 python 制作 discord 机器人的新手,我想制作一个活动,当有人加入服务器时显示欢迎消息。
我用这段代码试过
import discord
import random
from discord.ext import commands
alfred = commands.Bot(command_prefix = '!', description = "Hey!, I'm Alfred, How can I assist you?")
#EVENT
@alfred.event
async def on_ready():
print("I'm Alfred and I'm Online!")
@alfred.event
async def on_member_join(member):
embed=discord.Embed(title="Welcome!",description=f"{member.mention} Just Joined")
await message.channel.send(embed=embed)
但它不起作用,甚至不和谐的文档都说该事件是“on_member_join”。
我真的希望你能帮助我:)
【问题讨论】:
标签: python discord bots discord.py