问题描述
对于制作不和谐的bot和python来说是新手,所以任何帮助都是完美的
@client.command()
async def hello(ctx,member):
await ctx.send(f"hello,{member}")
解决方法
您可以使用def insert(character):
old_entry_content = entry_name.get()
entry_name.delete(0,END)
entry_name.insert(0,old_entry + str(character))
user.name
@client.command()
async def hello(ctx):
await ctx.send(f"hello,{ctx.author.name}")
可以调用以上内容,即使您只是发送“ hello”(不带前缀),如果您想说“ hello {name}”,请使用{prefix}hello
事件。
on_message
,
这应该起作用: str(ctx.message.author) 要么: str(ctx.author)
,假设您要提及使用该命令的用户。 ctx
参数具有很多属性,其中之一是作者
@client.command()
async def hello(ctx,member):
await ctx.send(f"hello,{ctx.author}")
如果您希望用户与其他用户打招呼,他可以提及或直接输入名称。
@client.command()
async def hello(ctx,*,user: discord.Member = None):
if user:
await ctx.send(f"hello,{user.mention}")
else:
await ctx.send('You have to say who do you want to say hello to')
以上提供给您的所有信息都使用discord.ext.commands