You've already forked STARK
mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-07-02 22:36:54 +02:00
add Response class, recursive voice assistant algorithm
This commit is contained in:
@ -1,16 +1,12 @@
|
||||
from .Raspi import *
|
||||
import os
|
||||
from Command import Callback
|
||||
from Command import Callback, Response
|
||||
import config
|
||||
################################################################################
|
||||
def reboot(params):
|
||||
if params['bool']:
|
||||
os.system('sudo reboot')
|
||||
return {
|
||||
'text': 'Хорошо',
|
||||
'voice': 'Хорошо',
|
||||
'type': 'simple',
|
||||
}
|
||||
return Response(text = '', voice = '')
|
||||
|
||||
reboot_cb = Callback(['$bool',])
|
||||
reboot_cb.setStart(reboot)
|
||||
@ -20,19 +16,11 @@ def method(params, finish_event):
|
||||
os.system('git -C '+config.path+' remote update')
|
||||
if not 'git pull' in os.popen('git -C '+config.path+' status -uno').read():
|
||||
finish_event.set()
|
||||
return {
|
||||
'text': 'Установлена последняя версия',
|
||||
'voice': 'Установлена последняя версия',
|
||||
'type': 'simple',
|
||||
}
|
||||
return Response(text = text, voice = voice)
|
||||
os.system('git -C '+config.path+' pull')
|
||||
finish_event.set()
|
||||
return {
|
||||
'text': 'Обновления скачаны. Перезагрузиться?',
|
||||
'voice': 'Обновления скачаны. Перезагрузиться?',
|
||||
'type': 'question',
|
||||
'callback': reboot_cb,
|
||||
}
|
||||
voice = text = 'Обновления скачаны. Перезагрузиться?'
|
||||
return Response(text = text, voice = voice, callback = reboot_cb)
|
||||
|
||||
patterns = ['* обновись *', '* можешь обновиться *', '* обнови себя *', '* скачай обновлени* *', '* провер* обновлени* *']
|
||||
gitpull = Raspi('git pull archie.git', [], patterns)
|
||||
|
Reference in New Issue
Block a user