79622129

Date: 2025-05-14 19:12:00
Score: 4
Natty:
Report link

Found a way to check user input in a list, am removing the MyView() class and buttons for the time being. I tried using any(), which requires me to use str() on message.content as any() will not take in ctx objects or parameters.

@bot.command()
async def diagnose(ctx):
    await ctx.send(f'Hello, I am the R.E.M.E.D.Y. Bot. I can assist you with a diagnosis and recommend a remedy for it.'
                   'What symptom are you mainly experiencing?')
    
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel 

    try:
        message = await bot.wait_for('message', check = check)
    except asyncio.TimeoutError:
        await ctx.send("You took too long to respond. The command has closed.")
  
    
    if any(str(message.content) in item for item in allergy_symptoms):
        await ctx.send("Thank you for sharing your symptoms. To help me with your diagnosis, please tell me if you've experienced any of the following symptoms below:")

        final_string = print_list_no_string(allergy_symptoms, message.content)
   
        await ctx.send('\n'.join(final_string))

        def check(message):
            return message.author == ctx.author and message.channel == ctx.channel
        
        try:
            message = await bot.wait_for('message', check = check)
        except asyncio.TimeoutError:
            await ctx.send("You took too long to respond. The command has closed.")

        if message.content == "yes":
            await ctx.invoke(bot.get_command('allergy_diagnosis'))
            await ctx.invoke(bot.get_command('allergy_remedy'))
        
        else:
            await ctx.send("It seems that R.E.M.E.D.Y. Bot was unable to diagnose you. Please reach out to your primary care provider for support. Feel better.")


    else:
        await ctx.send("It seems that R.E.M.E.D.Y. Bot was unable to diagnose you. Please reach out to your primary care provider for support. Feel better.")
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Blacklisted phrase (1): help me
  • RegEx Blacklisted phrase (2.5): please tell me
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: senorbryan