我正试图使我的机器人“检查”一下,以查看命令中提到的人是否是机器人,但我不确定如何。这是我的代码:
@client.command(aliases=['Noob', 'NOOB'])
async def noob(ctx, member: discord.Member):
member = member.mention
text = [ f'{member} is a certified Noob:tm:',
f'{member} is a noob!!',
ctx.author.mention + f' calls {member} a noob, but they use a Uno reverse card',
ctx.author.mention + f' attemts to call {member} a noob, but fails.',
f'{member} is the biggest noob there is!!!',
f'{member} is a noob, but a really cool one tbh :eyes:',
ctx.author.mention + f' *thinks* {member} is a noob']
if [this is where I'm trying to add the check] == True:
await ctx.send('sorry, i will not betray my kind :pensive:')
else:
await ctx.send(f'{random.choice(text)}')
谢谢
答案 0 :(得分:1)
您可以使用member.bot
检查该成员是否为漫游器。
@client.command(aliases=['Noob', 'NOOB'])
async def noob(ctx, member: discord.Member):
mention= member.mention
text = [ f'{mention} is a certified Noob:tm:',
f'{mention} is a noob!!',
ctx.author.mention + f' calls {mention} a noob, but they use a Uno reverse card',
ctx.author.mention + f' attemts to call {mention} a noob, but fails.',
f'{mention} is the biggest noob there is!!!',
f'{mention} is a noob, but a really cool one tbh :eyes:',
ctx.author.mention + f' *thinks* {mention} is a noob']
if member.bot:
await ctx.send('sorry, I will not betray my kind :pensive:')
else:
await ctx.send(f'{random.choice(text)}')