gpt4 book ai didi

python - 我正在制作一个使用 8ball 的机器人,所以它说 'random' 不是 var 但我还能做什么,随机答案?

转载 作者:太空宇宙 更新时间:2023-11-03 20:23:11 24 4
gpt4 key购买 nike

@client.command(aliases=['8ball', 'test'])
async def _8ball(ctx, *, question):
responses =['As I see it, yes.',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Concentrate and ask again.',
'Don’t count on it.',
'It is certain.',
'It is decidedly so.',
'Most likely.',
'My reply is no.',
'My sources say no.',
'Outlook not so good.',
'Outlook good.',
'Reply hazy, try again.',
'Signs point to yes.',
'Very doubtful.',
'Without a doubt.',
'Yes.',
'Yes – definitely.',
'You may rely on it.']
await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')

最佳答案

试试这个:

import random
@client.command(aliases=['8ball', 'test'])
async def _8ball(ctx, *, question):
responses =['As I see it, yes.',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Concentrate and ask again.',
'Don’t count on it.',
'It is certain.',
'It is decidedly so.',
'Most likely.',
'My reply is no.',
'My sources say no.',
'Outlook not so good.',
'Outlook good.',
'Reply hazy, try again.',
'Signs point to yes.',
'Very doubtful.',
'Without a doubt.',
'Yes.',
'Yes – definitely.',
'You may rely on it.']
responce = random.choice(responses)
await ctx.send(f'Question: {question}\nAnswer: {responce}')

关于python - 我正在制作一个使用 8ball 的机器人,所以它说 'random' 不是 var 但我还能做什么,随机答案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58030116/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com