首页 > 解决方案 > AttributeError:“NoneType”对象没有“发送”属性

问题描述

我想向特定频道发送消息,我按照不和谐的步骤进行操作,我正确地按照他们的步骤操作,但它不起作用。这是我遵循的步骤http://discordpy.readthedocs.io/en/rewrite/faq.html#how-do-i-send-a-message-to-a-specific-channel

这是我的代码:

@bot.event
async def on_member_join(member):
    print("A member just joined and his name is" + member.name)
    general = bot.get_channel(466675715333554179)
    mid = member.id
    await general.send('Welcome <@%s> to OnePlix server, I am Cooler!' % (mid))

标签: pythondiscorddiscord.py

解决方案


这是一个愚蠢的错误。我输入了错误 discord.py 版本的常见问题解答。

解决方案是这样的

await client.send_message(discord.Object(id='12324234183172'), 'hello')

推荐阅读