def run(self, event): word_list = Commons.read_file_to_list("store/ouija_wordlist.txt") num_words = Commons.get_random_int(1, 3)[0] rand_words = Commons.get_random_choice(word_list, num_words) output_string = "I'm getting a message from the other side... {}.".format( " ".join(rand_words) ) return event.create_response(output_string)
def test_read_file_to_list(): data = Commons.read_file_to_list("hallo/test/inc/test.txt") assert len(data) == 5 assert data[0] == "test1" assert data[1] == "test2" assert data[2] == "test3" assert data[3] == "test4" assert data[4] == "test5"
def load_thought_list(self): self.thought_list = Commons.read_file_to_list("store/WH40K_ToTD2.txt")