Investigation

Bot and asyncio task block each other for reason.

  • Tried calling asyncio.create_task separately from the chatbot. This appears to block the chat commands.
  • Tried to move logic for the word tracker in the chatbot on event_ready. This did not work because any chat commands that get called after the asyncio.ensure_future(recordWordsFromMicrophone(self.wt)) appears to block / none of the commands work. Digging into the documentation, it appears that ensure future blocks until future is cancelled so this definitely should not work.
  • A quick GitHub search shows how other people are using @routines.routine. Apparently, this should be called in the context on the bot class.

What worked

I gave up on trying to run the bot and asyncio task to record from the microphone. Instead I decided to block on the microphone then send a chat message.

I also learned that asyncio.ensure_future blocks for futures (as noted above).

Tasks that we will not do:

  • Fire and forgetting.
  • We could use the twichio.ext.routines to schedule sending chat the top words said during stream in an interval.
  • Call the chat bot and word tracker separately without blocking each other.

Future work

  • Use GitHub integrations to run Python test with Poetry.
  • Create blog post / Youtube video setting up static website (hugo).
  • Create blog post / Youtube video with GCP cloud storage and load balancer
  • Create blog post / Youtube video for Firebase.
  • Type more in Colemak.