【发布时间】:2019-03-21 02:32:36
【问题描述】:
@bot.event
async def on_memeber_join(member):
channel = member.server.get_channel("449873043913834506")
await bot.send_message(channel, "'''{} has joined.'''".format(user.name))
role = discord.utils.get(member.server.roles, name="UNRANK")
await bot.add_roles(member, role)
@bot.event
async def on_memeber_leave(member):
channel = member.server.get_channel("449873043913834506")
await bot.send_message(channel, "'''{} has left. '''".format(user.name))
这是我的代码,我不知道是什么问题。 在控制台中没有发现任何错误,但是当有人加入或离开时,机器人什么也不发送。
【问题讨论】:
-
您使用的是 discord rewrite 还是普通版本的 discord.py?
-
您是否有一些可以抑制错误消息的错误处理程序?
-
@PatrickHaugh,discord.py 的问题是,如果一切“正常”,它通常不会告诉你出了什么问题,很有可能一切都做对了(有点),但这并不是真的正确。因此,它不会带来任何错误。
标签: python bots discord discord.py