Steve522
Steve522

Reputation: 13

Discord command not entirely functional, any ideas?

I wrote a DM command for my discord bot, it only partly works because the user can only see one word of the message, any ideas on how to fix that?

@client.command(pass_context=True)
@commands.cooldown(1, 10, commands.BucketType.user)
async def dm(ctx, target: discord.User, message=None):
    author = ctx.author
    mention = ctx.message.author.mention
    await target.send(message)

    await ctx.send("{0} has recieved your message, {1} :envelope:".format(target.mention, mention))

Upvotes: 1

Views: 33

Answers (1)

SuperStormer
SuperStormer

Reputation: 5407

You should use keyword-only arguments.

async def dm(ctx, target: discord.User, *, message)

(It defaults to a blank str if no arg is passed)

Upvotes: 1

Related Questions