我刚用python制作了一个不和谐的机器人,我想让一个事件在有人加入服务器时显示一条欢迎消息。
我试过用这个代码
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“。
我真的希望你能帮我:)
发布于 2020-12-31 23:52:52
试试这个,只需用您的通道id替换790274325533378682即可。
@alfred.event
async def on_member_join(member):
channel = alfred.get_channel(790274325533378682)
embed=discord.Embed(title="Welcome!",description=f"{member.mention} Just Joined")
await channel.send(embed=embed)https://stackoverflow.com/questions/65525278
复制相似问题