IDK
IDK

Reputation: 131

Creating Say Command discord.py

I am creating "say" command for my bot and it is fine, But when I tag someone in-between content it does not send the remaining message.

For Example:

!say [user mention] take your role asap

but the output is:

[user mention]

Code:

@bot.command(name='say')
async def audit(ctx, msg=None):
    if msg is not None:
        await ctx.send(msg)

Thanks in advance for your help

Upvotes: 0

Views: 172

Answers (1)

loloToster
loloToster

Reputation: 1415

That's because you seperate arguments by spaces. To make argument that has space inside it simply put * inside of the async def audit(ctx, msg=None): like that:

async def audit(ctx, *, msg=None):

then discordpy will know that everything after !say should be an argument.

Upvotes: 1

Related Questions