简体   繁体   English

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

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

How do I get the user who wrote the bot command?如何获取编写 bot 命令的用户? 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)

ctx.author will give you the Member that sent the message. ctx.author会给你发送消息的Member

暂无
暂无

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

相关问题 Discord.py:我如何让机器人获得在给定时间内对消息做出反应的用户列表 - Discord.py: how do i make the bot get a list of users who reacted to a message in a given time 如何让我的机器人从用户运行命令的位置获取通道 ID? (不和谐.py) - How do I make my bot get the channel Id from where the user ran the command from? (Discord.py) Discord.py:如何获取触发 on_member_update 的用户名? - Discord.py: How do I get the name of the user who triggers on_member_update? discord.py 如何让机器人在特定用户类型时发送消息? - discord.py how do I get a bot to send a message when a specific user types? discord.py:如何让邀请/添加机器人到他的服务器的用户? [解决方案] - discord.py: How to get the user who invited/added the bot to his server? [solution] Discord.py - 我怎样才能通过我的机器人获得语音频道中所有成员的数量? - Discord.py - How can I get the amount of all members who are in a voicechannel with my bot? 如何在 discord.py 中的命令(例如 User: :send 1234 Bot?1234)后重新发送用户输入? - How do I resend user input after a command (e.g. User: !send 1234 Bot: 1234) in discord.py? 如何在 discord.py 中为 discord 音乐机器人创建跳过命令? - How do I create a skip command for discord music bot in discord.py? 如何在 Discord.py 中获取用户的 ID - How do I get the ID of an user in Discord.py 如何使用 discord.py 获取用户 ID? - How do I get the user's ID with discord.py?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM