1
votes
@client.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def say(ctx, *, response):
  if "@" in say.content.contains:
    await ctx.send("no")
  else:
    response = response.replace("(", "")
    response = response.replace(")", "")
    await ctx.send(response)

I'm trying to make it so if you type .say then anything with an @ will cancel the command

error message: if "@" in say.content.contains: AttributeError: 'Command' object has no attribute 'content'

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

Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 859, in invoke await injected(*ctx.args, **ctx.kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'content'

1
Instead of say.content did you mean ctx.message.content? say is the name of your function, not a variable containing the message. - Kemp

1 Answers

1
votes

Don't Use Say.content. The Variable Say isn't the Message Being Typed, It's The Function/Name of the Function.

Try Using Message.Content Instead of Say.content