【发布时间】:2020-04-29 01:17:43
【问题描述】:
该命令有效,但当您与自己调情时,它不会显示正确的消息。它只会显示您与其他人调情时发送的消息。
@client.command()
async def flirt(ctx, *, user):
flirts = ["I wish I was your mirror, so that I could look at you every morning.",
"When I need a pick me up, I just think of your laugh and it makes me smile.",
"Sweet dreams… I hope I’m in them.",
"If I had a candy bar for every time I thought of you, I would be fat.",
"My heart skips a beat every time I think of you. Or maybe it’s more of a somersault.",
"For some reason every love song makes me think of you…",
"It’s said that nothing lasts forever. Will you be my nothing?",
"I’m lucky because I have plans for today, for tomorrow, for the week, and for my whole life—to make you happy.",
" I don’t think about very many things, and I don’t think for very long, but when I do think, it invariably tends to be about you.",
"It’s not my fault that I fell for you, you tripped me!",
"I guess your parents are bakers, because they made you such a cutie pie!",
"You might fall from a mountain, or you might fall from a tree, but the perfect way for you to fall, is to fall in love with me."]
if user != ctx.message.author:
await ctx.send(str(user) + ", " + str(ctx.message.author.mention) + " flirted with you! They said: \"" + random.choice(flirts) + "\"")
elif user == ctx.message.author:
await ctx.send(str(ctx.message.author.mention) + ", I flirted with you! I said: \"" + random.choice(flirts) + "\"")
【问题讨论】:
-
user是一个字符串,而ctx.message.author是一个User对象。您希望输入的是该对象的哪些属性? -
我希望当你这样做的时候!flirt @yourself,它会发送```await ctx.send(str(ctx.message.author.mention) + ",我和你调情了!我说: \"" + random.choice(flirts) + "\"") ``` 但是它发送 ``` await ctx.send(str(user) + ", " + str(ctx.message.author.mention) + " 和你调情!他们说:\"" + random.choice(flirts) + "\"") ``
标签: discord.py