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.")