Reputation: 21
@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'
Upvotes: 0
Views: 239
Reputation: 54
Don't use say.content
. The variable say
isn't the message being typed, it's the function/name of the function.
Try using ctx.message.content
instead of say.content
Upvotes: 2