Как добавить команду в slash_command?
Я создал slash
команду для удаление сообщение в дискорд-сервере. Но она не работает.
@bot.slash_command(description='Эта команда может удалять сообщения в чате.')
async def clear(ctx, amount=100):
# amount = int('1') # пробовал так, но тоже не работает
await ctx.channel.purge(limit=amount)
Работает только так, НО я так не хочу.
@bot.command()
async def clear(ctx, amount=100):
await ctx.channel.purge(limit=amount)
Выводит вот такую ошибку:
File "C:\Users\maksi\PycharmProjects\DS-BOT\venv\lib\site-
packages\disnake\iterators.py", line 325, in _get_retrieve
if limit is None or limit > 100:
TypeError: '>' not supported between instances of 'str' and 'int'
The above exception was the direct cause of the following exception:
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception:
TypeError: '>' not supported between instances of 'str' and 'int'
Источник: Stack Overflow на русском