小编qsp*_*zer的帖子

在一个cog discord.py中的@ bot.event

我想知道是否可以在coord中使用@ bot.event for discord.py.我试过了

@self.bot.event
async def on_member_join(self, ctx, member):
    channel = discord.utils.get(member.guild.channels, name='general')
    await channel.send("hello")
Run Code Online (Sandbox Code Playgroud)

在我的cog类中,但是我得到了错误

NameError: name 'self' is not defined
Run Code Online (Sandbox Code Playgroud)

即使我在__init __中定义了self.bot.

在齿轮中做bot.event有不同的方式,还是不可能?

python-3.x discord discord.py

2
推荐指数
2
解决办法
3815
查看次数

标签 统计

discord ×1

discord.py ×1

python-3.x ×1