Reputation: 13
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
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