title: discord python bot getting user input
body: <p>I want to start a hangman game after .hm is called and the user then be able to enter in characters without command prefixes to play the game. I've looked at the documentation <a href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for_message" rel="nofollow noreferrer">https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for_message</a>
  and tried to mimic user input checking but am unsuccessful. The last line before the code yields no output is: print('Running')</p>
  <pre><code>@client.event
  async def on_message(message):
     global Hangman, guessed, tries, guessed_letters, channel, word, word_completion, guessed_words
  
     if message.content.startswith('.hm'):
         Hangman = True
         print(&quot;hangman started&quot;)
         channel = message.channel
         word = get_word()
         word_completion = &quot;_&quot; * len(word)
         guessed = False
         guessed_letters = []
         guessed_words = []
         tries = 6
  
         await channel.send(&quot;Let's play hangman&quot;)
         await channel.send(display_hangman(tries))
         await channel.send(word_completion)
  
     elif message.content.startswith('.hm quit'):
         Hangman = False
  
     if Hangman:
         print(str(guessed) + str(tries))
         if not guessed and tries &gt; 0:
  
             def check(m):
                 if any(c.isalpha() for c in m.content) and len(str(m)) == 1:
                     return m.content == message
  
             print('Running')
             guess = await client.wait_for('message', check=check)
             print(str(guess))
  
             if len(str(guess)) == 1:
                 if guess in guessed_letters:
                     await channel.send(&quot;You already guessed the letter&quot;, guess)
                 elif guess not in word:
                     await channel.send(guess, &quot;is not in the word.&quot;)
                     tries -= 1
                     guessed_letters.append(guess)
                 else:
                     await channel.send(&quot;Good job,&quot;, guess, &quot;is in the word!&quot;)
                     guessed_letters.append(guess)
                     word_as_list = list(word_completion)
                     indices = [i for i, letter in enumerate(word) if letter == guess]
                     for index in indices:
                         word_as_list[index] = guess
                     word_completion = &quot;&quot;.join(word_as_list)
                     if &quot;_&quot; not in word_completion:
                      guessed = True
             elif len(guess) == len(word) and guess.isalpha():
                 if guess in guessed_words:
                     await channel.send(&quot;You already guessed the word&quot;, guess)
                 elif guess != word:
                     await channel.send(guess, &quot;is not the word.&quot;)
                     tries -= 1
                     guessed_words.append(guess)
                 else:
                     guessed = True
                     word_completion = word
             else:
                 await channel.send(&quot;Not a valid guess.&quot;)
             await channel.send(display_hangman(tries))
             await channel.send(word_completion)
  
         if guessed:
             await channel.send(&quot;Congrats, you guessed the word! You win!&quot;)
         else:
             await channel.send(&quot;Sorry, you ran out of tries. The word was &quot; + word + &quot;. Maybe next time!&quot;)
  </code></pre>
  <p>get_word() just gets a random word from another .py file.</p>