Discord.py: Say command

Created on 16 Feb 2017  路  4Comments  路  Source: Rapptz/discord.py

I have created this command

@bot.command()
async def say(self):
"""Makes me say something :eyes:"""
await bot.say(content)

Any help?

all I get is blank and no reply from bot if I do
!say hi

question

Most helpful comment

Is that in a class? If so you need to use @commands.command
and you passed self wich is for when you use a class.
The parameters do not seem to be correct...

Heres an example:

```

main script:

@bot.command()
async def say(content):
"""Makes me say something 馃憖"""
await bot.say(content)

In a class:

@commands.command()
async def say(self, content):
"""Makes me say something 馃憖"""
await self.bot.say(content)

All 4 comments

Is that in a class? If so you need to use @commands.command
and you passed self wich is for when you use a class.
The parameters do not seem to be correct...

Heres an example:

```

main script:

@bot.command()
async def say(content):
"""Makes me say something 馃憖"""
await bot.say(content)

In a class:

@commands.command()
async def say(self, content):
"""Makes me say something 馃憖"""
await self.bot.say(content)

Thanks, Do you know how to setup permissions for commands?

You can view an example at
https://github.com/Rapptz/RoboDanny/blob/master/cogs/utils/checks.py

You'd need to import that module and use the functions as a decorator
bellow (or etc) the @commands.command as @checks.is_owner() or other
checks. The bot also has some inbuilt checks in the commands extension.

On Feb 16, 2017 7:21 AM, "Jake Stanley" notifications@github.com wrote:

Thanks, Do you know how to setup permissions for commands?

Ignoring the other replies, the main issue is your content variable doesn't exist. Plus, it doesn't look like you're in a class, so you don't need self

Change this:
async def say(self):
To this:
async def say(*, content):

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rektile picture rektile  路  18Comments

downloadpizza picture downloadpizza  路  14Comments

haaddaa1 picture haaddaa1  路  14Comments

0x78f1935 picture 0x78f1935  路  20Comments

Yuvira picture Yuvira  路  18Comments