SamSwift commited on
Commit
564de44
·
1 Parent(s): 7bde6c8

Upload script.py

Browse files
Files changed (1) hide show
  1. script.py +47 -0
script.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+
4
+ def activate_hausa(command):
5
+ try:
6
+ if ('kan' in command and 'fallo' in command.split()) or ('kan' in command and 'falo' in command.split()) or ('kan' in command and 'ballo' in command.split()):
7
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=0')
8
+ return "Ok, i'm turning on the parlor light"
9
+
10
+ elif ('kashi' in command and 'fallo' in command.split()) or ('ka shi' in command and 'fallo' in command.split()) or ('ka shi' in command and 'balo' in command.split()) or ('kashi' in command and 'falo' in command.split()) or ('ka shi' in command and 'falo' in command.split()) or ('ka she' in command and 'balo' in command.spilt()) or ('ka she' in command and 'ballo' in command.spilt()):
11
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=1')
12
+ return "Ok, i'm turning off the parlor light"
13
+ else:
14
+ return "Couldn't quite understand that, try again"
15
+ except (TypeError, AttributeError) as e:
16
+ pass
17
+
18
+
19
+ def activate_english(command):
20
+ try:
21
+ if command == 'turn off parlor light':
22
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=0')
23
+ return "Ok, i'm turning on the parlor light"
24
+ elif command == 'turn on parlor light':
25
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=1')
26
+ return "Ok, i'm turning off the parlor light"
27
+ else:
28
+ return "Couldn't quite understand that, try again"
29
+ except NoneType as e:
30
+ pass
31
+
32
+
33
+ def activate_yoruba(command):
34
+ try:
35
+ if ('tan' in command and 'pá lọ̀' in command.split()) or ('tọ' in command and 'pa lọ̀' in command.split()) or ('tán' in command and 'pá lọ' in command.split()) or ('tọ́' in command and 'pá lọ' in command.split()):
36
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=0')
37
+ return "Ok!, i'm turning on the parlor light"
38
+
39
+ elif ('pá' in command and 'pá lọ' in command.split()) or ('pa' in command and 'pa lọ' in command.split()) or ('pa' in command and 'pà lọ' in command.split()) or ('pà' in command and 'pà lọ' in command.split()) or ('ka shi' in command and 'falo' in command.split()) or ('ka she' in command and 'balo' in command.spilt()) or ('ka she' in command and 'ballo' in command.spilt()):
40
+ requests.get('https://blynk.cloud/external/api/update?token=G8ynpU1qu1pivhBZuJwaI542ijnLAOsv&v0=1')
41
+ return "Ok!, i'm turning off the parlor light"
42
+ else:
43
+ return "Couldn't quite understand that, try again"
44
+ except (TypeError, AttributeError) as e:
45
+ pass
46
+
47
+