【问题标题】:how to compare between between m.author and member.id? python如何在 m.author 和 member.id 之间进行比较? Python
【发布时间】:2021-06-12 13:00:31
【问题描述】:
@client.command()
async def marry(ctx, member:discord.Member):
    embed=discord.Embed(title="زواج", description=f"{member.mention} هل توافق على الزواج من {ctx.message.author.mention}؟", color=0xc91313)
    embed.set_author(name="شيخ المافيا", url="https://cdn.discordapp.com/attachments/707638848225542290/820740161859092520/STK-20200526-WA0007.webp", icon_url="https://cdn.discordapp.com/attachments/707638848225542290/820740161859092520/STK-20200526-WA0007.webp")
    embed.set_thumbnail(url=member.avatar_url)
    embed.set_footer(text=member.guild, icon_url=member.guild.icon_url)
    if member == ctx.message.author:
        await ctx.send('لا يمكنك الزواج من نفسك!')
    else:
        await ctx.send(embed=embed)
        await ctx.send(f'{member.mention} اذا كنت موافقا على الزواج ارسل كلمة `اوافق`.')
        def check(m):
            return m.content == 'smth' and 
        msg = await client.wait_for('message', check=check)
        await ctx.send(f'مبروك الزواج {member.mention} و {ctx.message.author.mention}')

对不起,我只希望机器人回复提到的成员 不是写smth的人

【问题讨论】:

    标签: python python-3.x discord discord.py bots


    【解决方案1】:

    m.author.id?你试过吗?真的很简单的逻辑……或者你可以简单地做m.author == member

    def check(m):
        return m.content == "smth" and m.author == member # or m.author.id == member.id
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      相关资源
      最近更新 更多