【发布时间】:2022-06-25 05:10:42
【问题描述】:
我第一次尝试使用斜杠命令创建一个不和谐的机器人,但我在运行我的程序时不断收到此错误!
Ignoring exception in on_connect
Traceback (most recent call last):
File "/home/runner/AgonizingDrabEmbeds/venv/lib/python3.8/site-packages/discord/client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "/home/runner/AgonizingDrabEmbeds/venv/lib/python3.8/site-packages/discord/bot.py", line 793, in on_connect
await self.register_commands()
File "/home/runner/AgonizingDrabEmbeds/venv/lib/python3.8/site-packages/discord/bot.py", line 460, in register_commands
await self.http.bulk_upsert_command_permissions(
File "/home/runner/AgonizingDrabEmbeds/venv/lib/python3.8/site-packages/discord/http.py", line 338, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed
Bot is online!
这是我的代码:
import discord
import os
token = os.environ["nekto"]
client = discord.Bot(owner_id=<my_user_id>)
async def on_ready():
print('Bot is online!')
guilds_ids = [<myGuildId>]
client.add_listener(on_ready)
client.run(token)
我们将不胜感激
【问题讨论】:
-
这看起来像是 PyCord 的问题。如果尚未报告,您可能想在他们的 GitHub 页面上打开一个问题
-
你有什么版本的
py-cord? -
我想我得到了 py-cord 2.0,我安装了 github 版本,但现在它工作正常
标签: python discord.py pycord