繁体   English   中英

如何获取编写 bot 命令的用户? Discord.py

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

如何获取编写 bot 命令的用户? 所以消息的作者。

代码:

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)

ctx.author会给你发送消息的Member

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM