Aaron
Aaron

Reputation: 237

Discord.py bot - how to make bot copy my message

I'm developing in Python. I'd like to make my bot copying the previous message, which contains a special command for this.

For example, I type the command say. So it would look like this:

Me: say What are you doing?

Bot: What are you doing?

Upvotes: 0

Views: 1452

Answers (3)

Aaron
Aaron

Reputation: 237

Thanks to @UziGoozie comment and @Seekii code, the solution to this problem is the next code:

async def on_message(message):
    echo = message.content.split(" ", 1)[1]
    if message.content.startswith("!say"):
    await message.channel.send(echo)

Upvotes: 0

šeki
šeki

Reputation: 153

@bot.listen()
async def on_message(message):
    if message.content.startswith("!say"):
        await message.channel.send(message.content)

Upvotes: 1

šeki
šeki

Reputation: 153

This work for me:

@bot.command()
async def say(ctx,*,args): 
    await ctx.send(args)

Upvotes: 1

Related Questions