簡體   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