MCPcopy Create free account
hub / github.com/jasperproject/jasper-client / getRandomJoke

Function getRandomJoke

client/modules/Joke.py:9–31  ·  view source on GitHub ↗
(filename=jasperpath.data('text', 'JOKES.txt'))

Source from the content-addressed store, hash-verified

7
8
9def getRandomJoke(filename=jasperpath.data('text', 'JOKES.txt')):
10 jokeFile = open(filename, "r")
11 jokes = []
12 start = ""
13 end = ""
14 for line in jokeFile.readlines():
15 line = line.replace("\n", "")
16
17 if start == "":
18 start = line
19 continue
20
21 if end == "":
22 end = line
23 continue
24
25 jokes.append((start, end))
26 start = ""
27 end = ""
28
29 jokes.append((start, end))
30 joke = random.choice(jokes)
31 return joke
32
33
34def handle(text, mic, profile):

Callers 1

handleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected