<commit_before>import asyncio

print("[Public Plugin] <trivia.py>: Trivia plugin.")


@asyncio.coroutine
def action(message, client):
    yield from client.send_message(message.channel, message.content)
<commit_msg>cant asyncio while falling asleep.<commit_after>import asyncio
import time
from threading import Thread

print("[Public Plugin] <trivia.py>: Trivia plugin.")

global filling_teams
filling_teams = False
global trivia_game
trivia_game = False
global trivia_answer
trivia_answer = "taco"


@asyncio.coroutine
def action(message, client):

    global filling_teams
    global trivia_game
    global trivia_answer

    if message.content == "!triviastart":

        # Fill teams loop
        filling_teams = True
        invite_message = "A trivia game is staring!"
        yield from client.send_message(message.channel, invite_message)
        t = Thread(target=fill_teams)
        t.start()
        while t.is_alive():
            yield from client.send_message(message.channel, "You have 30 seconds to join! Type !triviajoin to be placed on a team!")
            yield from asyncio.sleep(5)
            yield from client.send_message(message.channel, "You have 15 seconds to join! Type !triviajoin to be placed on a team!")
            yield from asyncio.sleep(5)
            yield from client.send_message(message.channel, "The game is now starting!")
            filling_teams = False

        # Trivia game loop
        trivia_game = True
        # t_game_thread = Thread(target=trivia_loop)
        # t_game_thread.start()
        # while t_game_thread.is_alive():

    if filling_teams:
        if message.content == "!triviajoin":
            yield from client.send_message(message.channel, "I'll add you to a team, " + str(message.author) + ".")

    if trivia_game:
        if str(message.channel) == "testgradius":
            if message.content == trivia_answer:
                yield from client.send_message(message.channel, "That is correct, " + str(message.author) + "!")


def fill_teams():
    time.sleep(10)

{'fraction_non_alphanumeric': 0.09416380578715057, 'fraction_numerical': 0.00392349190779794, 'mean_word_length': 3.0476190476190474, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866999', 'n_tokens_mistral': 634, 'n_tokens_neox': 610, 'n_words': 170}