I am trying to create a discord bot with slash commands for the first time and I keep on getting this error when I run my program!
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!
this is my code:
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)
Help would be appreciated
I was hitting the same issue. As per the comments suggested, I went and checked their Github.
Found the ticket . If I understand it correctly, there used to be an issue, but that has been resolved long time ago. So if you're running an old version, then you can try to update. For me, 2.0.0.b1 still had the bug, 2.0.0rc1 had fixed the issue.
If you're running a newer version, a dirty venv is the probably cause. Delete the venv folder and build it again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.