python - 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))
解决方案
这是一个愚蠢的错误。我输入了错误 discord.py 版本的常见问题解答。
解决方案是这样的
await client.send_message(discord.Object(id='12324234183172'), 'hello')
推荐阅读
- javascript - 如何建立以验证 html 中的至少一个输入字段?
- java - 引起:android.content.res.Resources$NotFoundException:字符串资源 ID #0x0
- jenkins - 如果任何量角器套件失败,除了最后一个,Jenkins Job 中的成功通知
- xamarin - Xamarin 形成内存问题
- php - 执行中的php代码错误
- mysql - 如何通过 Symfony 4 中的学说创建数据库表?
- c# - C# Api 控制器未接收到 json 参数
- c# - 如何在列表上使用 linq 查询按名称和编号 c# 查找最后一个数据?
- c++ - 基本分割错误
- apache-nifi - 使用nifi根据条件合并流文件?