我正在尝试创建一个使用客户机事件(如on_member_join
)和命令(@bot.command()
)的不协调Python Bot。on_member_join
事件不适用于@bot.event
,但on_ready
工作正常。
代码如下:
import discord
from discord.ext import commands
import os
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_member_join(member):
public = 'welcome, {0.mention}:'.format(member)
await member.guild.system_channel.send(public)
@bot.command()
async def ping(ctx):
await ctx.send('pong :sunglasses:')
bot.run(TOKEN)
如果有人能帮我,我将不胜感激
我看到你在做欢迎词。你可以做ctx.send而不是member.send你只需要通过ctx
这是我的欢迎信:
相关问题 更多 >
编程相关推荐