[英]How can I make my bot say something when it or another bot is used in the command? (discord.py)
I'm trying to make my bot "check" to see if the person mentioned in my command is a bot, but I'm not really sure how.我试图让我的机器人“检查”我的命令中提到的人是否是机器人,但我不确定如何。 Here is my code:这是我的代码:
@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)}')
Thanks,谢谢,
You can use member.bot
to check if the member is bot or not.您可以使用member.bot
来检查该成员是否为 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)}')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.