Ejemplo n.º 1
0
 def run(self, line, user_obj, destination_obj=None):
     """WH40K Thought for the day. Format: thought_for_the_day"""
     thought_list = Commons.read_file_to_list('store/WH40K_ToTD2.txt')
     rand = Commons.get_random_int(0, len(thought_list) - 1)[0]
     if thought_list[rand][-1] not in ['.', '!', '?']:
         thought_list[rand] += "."
     return '"' + thought_list[rand] + '"'
Ejemplo n.º 2
0
 def test_read_file_to_list(self):
     data = Commons.read_file_to_list("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"
Ejemplo n.º 3
0
 def run(self, line, user_obj, destination_obj=None):
     word_list = Commons.read_file_to_list('store/ouija_wordlist.txt')
     rand_list = Commons.get_random_int(0, len(word_list) - 1, 4)
     num_words = (rand_list[0] % 3) + 1
     output_string = "I'm getting a message from the other side..."
     output_string += " ".join([word_list[rand_list[x + 2]] for x in range(num_words)])
     output_string += "."
     return output_string
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 def load_thought_list(self):
     self.thought_list = Commons.read_file_to_list('store/WH40K_ToTD2.txt')