Answer the question
In order to leave comments, you need to log in
How to fix spam bot error?
In short, I want to prank a friend and "spam" him a little, but for some reason PyCharm writes an error.
I know it's probably simple. I just take all the code from the internet :/
CODE:
import discord
from discord.ext import commands
client = discord.Client()
bot = commands.Bot(command_prefix='!')
@bot.command(pass_context=True)
async def spam(ctx, m):
await ctx.message.delete() #удаляем сообщение пользователя, чтобы не спалился
count = 0
while count < int(m):
await ctx.send('@here Crash!!! ||Это пранк.||') #отправка текста
count += 1
bot.run('нету токена тут')
C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\Scripts\python.exe C:/Не важно как меня зовут!/PycharmProjects/pythonProject1/main.py
Ignoring exception in command spam:
Traceback (most recent call last):
File "C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\ext\commands\core.py", line 856, in invoke
await self.prepare(ctx)
File "C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\ext\commands\core.py", line 790, in prepare
await self._parse_arguments(ctx)
File "C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\Не важно как меня зовут!\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: m is a required argument that is missing.
Answer the question
In order to leave comments, you need to log in
Exception raised when parsing a command and a parameter that is required is not encountered
[p]spam
will give this error, [p]spam 12
it will not. typing.Optional
. @bot.command()
async def cmd(ctx, m: int = 5):
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question