I'm trying to make a guessing game in a Discord bot. I have the game done, but not sure how to retrieve user input via Discord. I know about that wait_for method to get a specific response. The problem is that it checks only for specific strings. I am looking for way to check for a list of possible strings and store whichever one it checks true for. (EX: If one of the strings is used as the it stores that input to a variable)
possible_numbers = [i for i in range(1,51)]
def check(m):
if m.content in possible_numbers:
return m.content == m.content and m.channel == channel
guess = await client.wait_for('message', check=check, timeout=120.0)
I am expecting for something along these lines to successfully check if m.content is in possible_numbers, and if so just retrieve m.content and store it as "guess". Currently it just outs puts nothing and if I change it to:
def check(m):
return m.content == '1' and m.channel == channel
guess = await client.wait_for('message', check=check, timeout=120.0)
It will only accept whatever is the direct string it checks for.