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

我正在尝试创建一个 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!!!')

谢谢!


潇潇雨雨
浏览 97回答 1
1回答

慕盖茨4494581

尝试这个: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!!!')
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python