How do I get the user who wrote the bot command? Discord.py

1.2k Views Asked by At

How do I get the user who wrote the bot command? So the author of the message.

Code:

import discord
from discord.ext import commands

client = commands.Bot(command_prefix='!')

@client.event
async def on_ready():
    print('Bot wurde gestartet: ' + client.user.name)
#wts        
@client.command()
async def wts(ctx,name_schuh,preis,festpreis,url):
    channel = client.get_channel(693503741156130897)
    embed=discord.Embed(title="WTS", description= "@USER", color=0x00ff00)
    embed.add_field(name="**Sneaker:** ", value= name_schuh)
    embed.add_field(name="**Price:** ", value=preis)
    embed.add_field(name="**Negotiable:** ", value=festpreis)
    embed.set_thumbnail(url= url)
    await channel.send( embed = embed)
1

There are 1 best solutions below

0
On BEST ANSWER

ctx.author will give you the Member that sent the message.