【发布时间】:2022-01-05 21:13:08
【问题描述】:
我想让它在我的机器人启动时向某些聊天发送消息。正常上电,一切都很好,当我已经使用特殊的重启命令时,就会发出这个错误。代码如下:
@client.event
async def on_ready():
changeStatus.start()
kvuqqs = client.get_channel(906998823187017728)
librar = client.get_channel(906168716197232660)
await kvuqqs.send('Айоу! Бот был включен. \nК сожалению, на данный момент обновлений нет. \n`l.хелп`')
await librar.send(embed=discord.Embed(title='Бот был включен!', description='Версия бота на данный момент: 2.0.1.', color=random.choice(colors)))
还有一个完整的错误:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Events' object has no attribute 'get_channel'
【问题讨论】:
标签: python python-3.x discord discord.py