-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsystem.py
More file actions
39 lines (26 loc) · 1.1 KB
/
system.py
File metadata and controls
39 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8-*-
import random
import re
import os
WORDS = []
def handle(text, mic, profile):
greetings = ["For you sir, always.","Naturally sir.","Running a systems check immediately."]
greeting = random.choice(greetings)
mic.say(greeting)
responseAudio = os.system("ping -c 1 192.168.1.41")
responseMedia = os.system("ping -c 1 192.168.1.107")
global message
message = ""
if responseAudio == 0 and responseMedia == 0:
output = ["All systems are ready.", "All systems are online.","You have programmed me, of course all the systems are fine."]
message = random.choice(output)
elif responseAudio == 1:
message = "I was unable to contact the audio server."
elif responseMedia == 1:
message = "I was unable to contact the media server."
elif responseAudio == 1 and responseMedia == 1:
output = ["All system are down.", "All system are offline.","I have run into a critical error, all system are down."]
message = random.choice(output)
mic.say(message)
def isValid(text):
return bool(re.search(r'\b(system|check|systems)\b', text, re.IGNORECASE))