Почему не работает help disnake?

import disnake
import datetime
from disnake.ext import commands
import bot


class Help(commands.Cog):
	def __init__(self, bot):
		self.bot = bot


	@commands.command()
	@commands.cooldown(1, 5, commands.BucketType.guild)
	async def help(self, ctx):
		embed = disnake.Embed(title="Help!", description="How to use the commands!", timestamp=datetime.datetime.utcnow(), colour=disnake.Colour.blue())
		embed.add_field(name=f"{bot.PREFIX}mute", value=f"Синтаксис: {bot.PREFIX}mute (пользователь) (причина)", inline=True)
		embed.add_field(name=f"{bot.PREFIX}unmute", value=f"Синтаксис: {bot.PREFIX}unmute (пользователь)", inline=True)
		embed.add_field(name=f"{bot.PREFIX}kick", value=f"Синтаксис: {bot.PREFIX}kick (пользователь) (причина)", inline=True)
		embed.add_field(name=f"{bot.PREFIX}ban", value=f"Синтаксис: {bot.PREFIX}ban (пользователь) (причина)", inline=True)
		embed.add_field(name=f"{bot.PREFIX}unban", value=f"Синтаксис: {bot.PREFIX}unban (пользователь)", inline=True)
		await ctx.reply(embed=embed)


def setup(bot):
	bot.add_cog(Help(bot))

<blockquote>Traceback (most recent call last):
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 453, in _load_from_module_spec
    setup(self)
  File "c:\bot\cogs\help.py", line 25, in setup
    bot.add_cog(Help(bot))
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 341, in add_cog
    cog = cog._inject(self)  # type: ignore
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\cog.py", line 747, in _inject
    raise e
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\cog.py", line 741, in _inject
    bot.add_command(command)  # type: ignore
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1217, in add_command
    raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 441, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\bot\cogs\help.py", line 4, in <module>
    import bot
  File "c:\bot\bot.py", line 40, in <module>
    bot.load_extension(f"cogs.{fn[:-3]}")
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 512, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 458, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.help' raised an error: CommandRegistrationError: The command help is already an existing command or alias.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\bot\bot.py", line 40, in <module>
    bot.load_extension(f"cogs.{fn[:-3]}")
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 512, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\bot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 443, in _load_from_module_spec
    del sys.modules[key]
KeyError: 'cogs.help'</blockquote>
  • Вопрос задан
  • 184 просмотра
Решения вопроса 1
SoreMix
@SoreMix Куратор тега Python
yellow
Потому что в боте уже есть стандартная комманда help.
Можно удалить её, передав в конструктор бота help_command=None

bot = commands.Bot(command_prefix='!', help_command=None)
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы