Reputation: 81
Im trying to make my custom bot sends a custom message using python
Me: ~repeat Hi
My Message deleted
custom-Bot: Hi
whenever I try using this I get error problems with this code specifically "client"
await client.delete_message(ctx.message)
return await client.say(mesg)
from discord.ext import commands
client = commands.Bot(command_prefix = '~') #sets prefix
@client.command(pass_context = True)
async def repeat(ctx, *args):
mesg = ' '.join(args)
await client.delete_message(ctx.message)
return await client.say(mesg)
client.run('Token')
Upvotes: 0
Views: 534
Reputation: 2041
client
does not have an attribute called delete_message
, to delete the author's message use ctx.message.delete
. To send a message in the rewrite branch of discord.py, you use await ctx.send()
@client.command()
async def repeat(ctx, *args):
await ctx.message.delete()
await ctx.send(' '.join(args))
Upvotes: 1