为了账号安全,请及时绑定邮箱和手机立即绑定

如何让我的机器人根据所选数字说出不同的内容?

如何让我的机器人根据所选数字说出不同的内容?

潇潇雨雨 2023-12-08 17:03:05
我正在尝试创建一个 hownoob 命令,我想知道如何让它根据数字的范围说出不同的内容?@client.command()async def hownoob(ctx, member: discord.Member):    number = random.randint(1,100)    member = member.mention    yo = [f'lol yeah, {member} biggest noob here 100% :ok_hand:',         f'noobness for {member} off the charts man!!!',         f'{member} is a big noob, but their style is a cool noob :wink:']    if number == 1-15:        await ctx.send(f'noobness for {member} is {number}% which is not very noob')    elif number == 16-49:        await ctx.send(f'noobness for {member} is {number}% lol')    elif number == 50-77:        await ctx.send(f'noobness for {member} is {number}% your half noob lol XD')    elif number == 78-89:        await ctx.send(f'{member} is {number}%-very much noob :eyes:')    elif number == 90-99:        await ctx.send(f'noobness for {member} is {number}% very noob!!!!')    elif number == 100:        await ctx.send(f'noobness for {member} is at max!!!')谢谢!
查看完整描述

1 回答

?
慕盖茨4494581

TA贡献1850条经验 获得超11个赞

尝试这个:


if number in range(16):

    await ctx.send(f'noobness for {member} is {number}% which is not very noob')

elif number in range(16,50):

    await ctx.send(f'noobness for {member} is {number}% lol')

elif number in range(50,78):

    await ctx.send(f'noobness for {member} is {number}% your half noob lol XD')

elif number in range(78,90):

    await ctx.send(f'{member} is {number}%-very much noob :eyes:')

elif number in range(90,100):

    await ctx.send(f'noobness for {member} is {number}% very noob!!!!')

elif number == 100:

    await ctx.send(f'noobness for {member} is at max!!!')


查看完整回答
反对 回复 2023-12-08
  • 1 回答
  • 0 关注
  • 96 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信