1
0
mirror of https://github.com/MarkParker5/STARK.git synced 2024-11-24 08:12:13 +02:00

use new flow for creating commands

This commit is contained in:
MarkParker5 2021-11-01 13:51:35 +02:00
parent 7a2cfaa59b
commit 29ec54d064
22 changed files with 210 additions and 314 deletions

View File

@ -1,19 +1,22 @@
from typing import Callable
from abc import ABC
from .RThread import RThread, Event
from ..Pattern import ACObject, Pattern
from .CommandsManager import CommandsManager
from .. import Pattern
class Command(ABC):
name: str
patterns: list[Pattern]
start: Callable
def __init__(self, name, keywords = {}, patterns = []): # initialisation of new command
self._name = name #TODO: change name to path
def __init__(self, name, patterns = [], primary = True):
self._name = name
self._patterns = patterns
CommandsManager().append(self)
def start(self, params: dict[str, ACObject]):
raise Exception(f'Method start is not implemented for command with name {name}')
def setStart(self, function): # define start (required)
self.start = function
@ -28,7 +31,7 @@ class Command(ABC):
@classmethod
def new(cls, *args, **kwargs):
def creator(func):
cmd: Command = cls(*args, **kwargs)
cmd: Command = cls(func.__name__, *args, **kwargs)
cmd.setStart(func)
return func
return cmd
return creator

View File

@ -1,4 +1,4 @@
from typing import Type
from typing import Type, Optional
from . import Command
from ..Pattern import ACObject
@ -18,7 +18,7 @@ class CommandsManager:
cls.instance = super().__new__(cls)
return cls.instance
def search(self, string) -> list[SearchResult]: # find command by pattern
def search(self, string: str, commands: list[Command]) -> list[SearchResult]:
string = string.lower()
results: list[SearchResult] = []
acstring = ACString(string)
@ -37,12 +37,15 @@ class CommandsManager:
if results: return results
else: return [SearchResult(Command.QA, {'string': acstring,}),]
def append(self, obj): # add new command to list
self.allCommands.append(obj)
def append(self, command):
if hasattr(self, command.name):
Exception('Error: command with name \'{command.name}\' already exist')
setattr(self, command.name, command)
if command.primary:
self.allCommands.append(command)
def getCommand(name): # TODO: quick search
for command in self.allCommands:
if command.name == name: return command
def getCommand(self, name) -> Optional[Command]:
return getattr(self, name) if hasattr(self, name) else None
@staticmethod
def classFromString(className: str) -> ACObject:

View File

@ -1,15 +1,24 @@
from typing import Optional
from enum import Enum, auto
from .Command import Command
from .ThreadData import ThreadData
class ResponseAction(Enum):
popContext = auto()
popToRootContext = auto()
sleep = auto()
repeatLastAnswer = auto()
class Response:
voice: str
text: str
callback: Optional[Command]
context: list[Command]
thread: Optional[ThreadData]
action: Optional[ResponseAction]
def __init__(self, voice, text, callback = None, thread = None):
def __init__(self, voice, text, context = [], thread = None, action = None):
self.voice = voice
self.text = text
self.callback = callback
self.context = context
self.thread = thread
self.action = action

View File

@ -38,7 +38,7 @@ class VoiceAssistant(Control):
break
text = speech['text']
for result in CommandsManager().search(text):
for result in CommandsManager().search(text, CommandsManager().allCommands):
try: response = result.command.start(result.parameters)
except: break

View File

@ -1,5 +1,71 @@
from ArchieCore import Command
class Media():
@staticmethod
def findPage(name):
query = name + ' site:kinogo.by'
responce = requests.get(f'https://www.google.ru/search?&q={query}&lr=lang_ru&lang=ru')
page = BS(responce.content, 'html.parser')
link = page.select_one('.ZINbbc.xpd.O9g5cc.uUPGi>.kCrYT>a')
title = page.select_one('.ZINbbc.xpd.O9g5cc.uUPGi .BNeawe.vvjwJb.AP7Wnd').text.split(' смотреть')[0].strip()
return (link['href'][7:].split('&')[0], title) if link else None
class Media(Command):
def start(self, string): # main method
pass
@staticmethod
def getFilm(url):
id = url[18:].split('-')[0].split(',')[-1]
url = f'https://kinogo.la/engine/ajax/cdn_download.php?news_id={id}'
responce = requests.get(url)
page = BS(responce.content, 'html.parser')
elems = page.children
for elem in elems:
if elem == '\n': continue
spans = elem.find_all('span')
audio = spans[1].text
if 'Оригинальная дорожка' in audio or 'Полное дублирование' in audio or 'LostFilm' in audio:
return elem.ul.li.a['href']
return None
@staticmethod
def getSerial(url):
id = url[18:].split('-')[0].split(',')[-1]
url = f'https://kinogo.la/engine/ajax/cdn_download.php?news_id={id}'
responce = requests.get(url)
page = BS(responce.content, 'html.parser')
elems = page.children
n = len(page.select('.cdn_download_season')) or 1
seasons = [None]*n
current_season = n-1
for elem in elems:
if elem == '\n': continue
if elem['class'][0] == 'cdn_download_season':
current_season = int(elem.text.split(' ')[0])-1
seasons[current_season] = {}
continue
spans = elem.find_all('span')
if not spans: break
audio = spans[2].text
if audio in ['Оригинальная дорожка', 'Полное дублирование', 'LostFilm']:
num = int(spans[0].text.split(' ')[0])-1
seasons[current_season][num] = {'href': elem.ul.li.a['href'], 'title': f'{current_season+1} сезон {num+1} серия'}
new_seasons = []
for dict_s in seasons:
season = [None]*(max(dict_s.keys())+1)
for i, value in dict_s.items():
season[i] = value
season = list(filter(None, season))
new_seasons.append(season)
return new_seasons
@staticmethod
def startFilm(url, title):
os.system(f'lxterminal --command="vlc {url} -f --meta-title=\\"{title}\\" "')
@staticmethod
def startSerial(seasons, name):
for season in seasons:
for series in season:
print(series)
href = series['href']
title = name + ' ' + series['title']
os.system(f'lxterminal --command="vlc --playlist-enqueue {href} --meta-title=\\"{title}\\" "')

View File

@ -1,140 +1,67 @@
from .Media import *
import requests
from bs4 import BeautifulSoup as BS
import os
from ArchieCore import Response
from .Media import Media
from ArchieCore import Command, Response
################################################################################
def findPage(name):
query = name + ' site:kinogo.by'
responce = requests.get(f'https://www.google.ru/search?&q={query}&lr=lang_ru&lang=ru')
page = BS(responce.content, 'html.parser')
link = page.select_one('.ZINbbc.xpd.O9g5cc.uUPGi>.kCrYT>a')
title = page.select_one('.ZINbbc.xpd.O9g5cc.uUPGi .BNeawe.vvjwJb.AP7Wnd').text.split(' смотреть')[0].strip()
return (link['href'][7:].split('&')[0], title) if link else None
def getFilm(url):
id = url[18:].split('-')[0].split(',')[-1]
url = f'https://kinogo.la/engine/ajax/cdn_download.php?news_id={id}'
responce = requests.get(url)
page = BS(responce.content, 'html.parser')
elems = page.children
for elem in elems:
if elem == '\n': continue
spans = elem.find_all('span')
audio = spans[1].text
if 'Оригинальная дорожка' in audio or 'Полное дублирование' in audio or 'LostFilm' in audio:
return elem.ul.li.a['href']
return None
def getSerial(url):
id = url[18:].split('-')[0].split(',')[-1]
url = f'https://kinogo.la/engine/ajax/cdn_download.php?news_id={id}'
responce = requests.get(url)
page = BS(responce.content, 'html.parser')
elems = page.children
n = len(page.select('.cdn_download_season')) or 1
seasons = [None]*n
current_season = n-1
for elem in elems:
if elem == '\n': continue
if elem['class'][0] == 'cdn_download_season':
current_season = int(elem.text.split(' ')[0])-1
seasons[current_season] = {}
continue
spans = elem.find_all('span')
if not spans: break
audio = spans[2].text
if audio in ['Оригинальная дорожка', 'Полное дублирование', 'LostFilm']:
num = int(spans[0].text.split(' ')[0])-1
seasons[current_season][num] = {'href': elem.ul.li.a['href'], 'title': f'{current_season+1} сезон {num+1} серия'}
new_seasons = []
for dict_s in seasons:
season = [None]*(max(dict_s.keys())+1)
for i, value in dict_s.items():
season[i] = value
season = list(filter(None, season))
new_seasons.append(season)
return new_seasons
def startFilm(url, title):
os.system(f'lxterminal --command="vlc {url} -f --meta-title=\\"{title}\\" "')
def startSerial(seasons, name):
for season in seasons:
for series in season:
print(series)
href = series['href']
title = name + ' ' + series['title']
os.system(f'lxterminal --command="vlc --playlist-enqueue {href} --meta-title=\\"{title}\\" "')
@Command.new(['$text'], primary = False)
def start_film(params):
name = params.get('text')
voice = text = 'Не могу найти фильм'
if name:
url, title = Media.findPage(name)
url = Media.getFilm(url)
if url:
Media.startFilm(url, title)
voice = text = 'Включаю'
return Response(text = text, voice = voice)
@Command.new(['включ* фильм $text', 'включ* фильм*'])
def film(params):
name = params.get('text')
if name:
url, title = findPage(name)
url = getFilm(url)
url, title = Media.findPage(name)
url = Media.getFilm(url)
if url:
startFilm(url, title)
Media.startFilm(url, title)
voice = text = 'Включаю'
else:
voice = text = 'Не могу найти фильм'
else:
voice = text = 'Какой фильм включить?'
callback = kinogo_film_cb
return Response(text = text, voice = voice, callback = callback)
return Response(text = text, voice = voice, context = [start_film,])
return Response(text = text, voice = voice)
def start_film(params):
################################################################################
@Command.new(['$text',], primary = False)
def start_serial(params):
name = params.get('text')
voice = text = 'Не могу найти фильм'
voice = text = 'Не могу найти сериал'
if name:
url, title = findPage(name)
url = getFilm(url)
url, title = Media.findPage(name)
seasons = Media.getSerial(url)
if url:
startFilm(url, title)
Media.startSerial(url, title)
voice = text = 'Включаю'
return Response(text = text, voice = voice)
@Command.new(['включ* сериал $text', 'включ* сериал*'])
def serial(params):
name = params.get('text')
if name:
url, title = findPage(name)
seasons = getSerial(url)
url, title = Media.findPage(name)
seasons = Media.getSerial(url)
if url:
startSerial(seasons, title)
Media.startSerial(seasons, title)
voice = text = 'Включаю'
else:
voice = text = 'Не могу найти'
else:
voice = text = 'Какой сериал включить?'
callback = kinogo_serial_cb
return Response(text = text, voice = voice, callback = callback)
return Response(text = text, voice = voice, context = [start_film,])
return Response(text = text, voice = voice)
def start_serial(params):
name = params.get('text')
voice = text = 'Не могу найти сериал'
if name:
url, title = findPage(name)
seasons = getSerial(url)
if url:
startSerial(url, title)
voice = text = 'Включаю'
return Response(text = text, voice = voice)
kinogo_film_cb = Callback(['$text',])
kinogo_film_cb.setStart(start_film)
patterns = ['* включ* фильм $text', '* включ* фильм*']
kinogo_film = Media('KinogoFilm', patterns)
kinogo_film.setStart(film)
kinogo_serial_cb = Callback(['$text',])
kinogo_serial_cb.setStart(start_serial)
patterns = ['* включ* сериал $text', '* включ* сериал*']
kinogo_serial = Media('KinogoSerial', patterns)
kinogo_serial.setStart(serial)

View File

@ -1,10 +1,6 @@
from ArchieCore import Command # import parent class
import os
class Raspi(Command):
def start(self, string): # main method
pass
class Raspi():
@staticmethod
def hdmi_cec(command):
os.system(f'echo \'{command}\' | cec-client -s -d 1')

View File

@ -1,18 +1,26 @@
from .Raspi import *
from .Raspi import Raspi
import os
from ArchieCore import CommandsManager, Callback, Response
from ArchieCore import Command, CommandsManager, Response
import config
################################################################################
@Command.new(['$bool'], primary = False)
def reboot(params):
if params['bool']:
os.system('sudo reboot')
return Response(text = '', voice = '')
reboot_cb = Callback(['$bool',])
reboot_cb.setStart(reboot)
################################################################################
@Command.new([
'обновись',
'можешь обновиться',
'обнови себя',
'скачай обновлени*',
'провер* обновлени*'])
@CommandsManager.background(answer = 'Проверяю обновления...', voice = 'Проверяю обновления')
def method(params, finish_event):
def gitpull(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()
@ -21,8 +29,4 @@ def method(params, finish_event):
os.system('git -C '+config.path+' pull')
finish_event.set()
voice = text = 'Обновления скачаны. Перезагрузиться?'
return Response(text = text, voice = voice, callback = reboot_cb)
patterns = ['* обновись *', '* можешь обновиться *', '* обнови себя *', '* скачай обновлени* *', '* провер* обновлени* *']
gitpull = Raspi('git pull archie.git', patterns)
gitpull.setStart(method)
return Response(text = text, voice = voice, context = [reboot,])

View File

@ -1,49 +1,44 @@
from .Raspi import *
from ArchieCore import Response
from ArchieCore import Command, Response
################################################################################
def method(params):
@Command.new(['включи* (телевизор|экран)'])
def tv_on(params):
Raspi.hdmi_cec('on 0')
Raspi.hdmi_cec('as')
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* включи* (телевизор|экран) *']
tv_on = Raspi('tv on', patterns)
tv_on.setStart(method)
################################################################################
def method(params):
@Command.new(['(выключи|отключи)* (телевизор|экран)'])
def tv_off(params):
Raspi.hdmi_cec('standby 0')
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (выключи|отключи)* (телевизор|экран) *']
tv_off = Raspi('tv off', patterns)
tv_off.setStart(method)
################################################################################
def method(params):
@Command.new(['* (выведи|вывести|покажи|открой|показать|открыть) * с (провода|hdmi|кабеля|порта) * $num *'])
def tv_hdmi_source(params):
port = params['num'] + '0' if len(params['num']) == 1 else params['num']
Raspi.hdmi_cec(f'tx 4F:82:{port}:00')
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (выведи|вывести|покажи|открой|показать|открыть) * с (провода|hdmi|кабеля|порта) * $num *']
tv_hdmi = Raspi('tv hdmi source', patterns)
tv_hdmi.setStart(method)
################################################################################
def method(params):
@Command.new(['* (выведи|вывести|покажи|открой|показать|открыть) * с (ноута|ноутбука|планшета|провода|hdmi)'])
def tv_hdmi_2(params):
Raspi.hdmi_cec('tx 4F:82:20:00')
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (выведи|вывести|покажи|открой|показать|открыть) * с (ноута|ноутбука|планшета|провода|hdmi)']
tv_hdmi = Raspi('tv hdmi source', patterns)
tv_hdmi.setStart(method)
################################################################################
def method(params):
@Command.new(['* (верни|вернуть|включи*|покажи|показать) [основн|нормальн|стандартн|привычн]* (телевизор|экран|картинк|изображение) *'])
def tv_hdmi_main(params):
Raspi.hdmi_cec('as')
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (верни|вернуть|включи*|покажи|показать) [основн|нормальн|стандартн|привычн]* (телевизор|экран|картинк|изображение) *']
tv_rpi = Raspi('tv rpi source', patterns)
tv_rpi.setStart(method)

View File

@ -1,10 +1,2 @@
# Create class SmallTalk
# Is child of Command
# Module for speaking with voice assistent
# See class Command
from ArchieCore import Command # import parent class
class SmallTalk(Command):
def start(self, string): # main method
print(f'Hello, {string=}')
class SmallTalk():
pass

View File

@ -2,9 +2,14 @@ import datetime, time
import requests
from bs4 import BeautifulSoup as BS
import math
from .SmallTalk import SmallTalk
from ArchieCore import Response
################################################################################
from ArchieCore import Command, Response
@Command.new([
'который * час в $text',
'скольк* * (врем|час)* * в $text',
'время в $text',
'который * час',
'скольк* * (врем|час)*'])
def method(params):
if city := params.get('text'):
city = city.title()
@ -87,13 +92,3 @@ def method(params):
else: text = f'Текущее время: {hours}:{minutes}'
return Response(text = text, voice = voice)
# keywords = {
# 10: ['который час', 'сколько времени'],
# 5: ['текущее', 'сейчас', 'время'],
# 1: ['сколько']
# }
patterns = ['* который * час в $text', '* скольк* * (врем|час)* * в $text', '* время в $text', '* который * час *', '* скольк* * (врем|час)* *']
# subpatterns = ['а (сейчас|в $text)']
ctime = SmallTalk('Current Time', patterns)
ctime.setStart(method)

View File

@ -1,8 +1,7 @@
from .SmallTalk import *
from ArchieCore import Response
################################################################################
from ArchieCore import Command, Response
@SmallTalk.new('Hello', patterns = ['* привет* *',])
def method(params):
@Command.new(['привет*',])
def hello(params):
voice = text = 'Привет'
return Response(text = text, voice = voice)

View File

@ -1,20 +0,0 @@
from .SmallTalk import *
import time
################################################################################
# Only for tests
# @SmallTalk.background(answer = 'Запуск фонового процесса', voice = 'Запускаю фоновый процесс')
# def method(params, finish_event):
# time.sleep(10)
# finish_event.set()
# return {
# 'text': 'Фоновый процесс завершен',
# 'voice': 'Фоновый процесс завершен',
# }
#
#
# keywords = {
# 10: ['тестирование', 'проверка', 'потоков', 'фоновых', 'процессов'],
# }
# patterns = ['* [тест|провер]* * [фонов*] * (процесс|поток)* *']
# test = SmallTalk('Test threads', keywords, patterns)
# test.setStart(method)

View File

@ -29,13 +29,10 @@ radio.stopListening()
radio.startListening()
class SmartHome(Command):
class SmartHome():
radio = radio
send_queue = []
def start(self, string): # main method
pass
@staticmethod
def send(data):
SmartHome.send_queue.append(data)

View File

@ -1,10 +1,12 @@
from .SmartHome import *
from .SmartHome import SmartHome
from ArchieCore import Response, Command
import Text2Speech
import os
################################################################################
def method(params):
@Command.new(primary = False)
def alarmclock(params):
text = voice = ''
Command.getCommand('tv on').start({})
Command.getCommand('window_open').start({})
@ -18,7 +20,3 @@ def method(params):
break
Text2Speech.Engine().generate(voice).speak()
return Response(text = text, voice = voice)
patterns = []
alarmclock = SmartHome('alarmclock', patterns)
alarmclock.setStart(method)

View File

@ -1,8 +1,10 @@
from .SmartHome import *
from ArchieCore import Response
################################################################################
def method(params):
@Command.new(['(открыть|открой) (окно|окна)', '(подними|поднять) (шторы|роллеты)'])
def mainLight(params):
SmartHome.send({
'target': 'main_light',
'cmd': 'light_on',
@ -10,14 +12,10 @@ def method(params):
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (включ|выключ)* свет *']
main_light = SmartHome('main_light', patterns)
main_light.setStart(method)
################################################################################
# led
def method(params):
@Command.new(['включи* подсветку'])
def ledOn(params):
SmartHome.send({
'target': 'led',
'cmd': 'led_on',
@ -25,36 +23,13 @@ def method(params):
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* включи* подсветку *']
light_on = SmartHome('led_on', patterns)
light_on.setStart(method)
################################################################################
def method(params):
@Command.new(['выключи* подсветку'])
def ledOff(params):
SmartHome.send({
'target': 'led',
'cmd': 'led_off',
})
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* выключи* подсветку *']
led_off = SmartHome('led_off', patterns)
led_off.setStart(method)
################################################################################
def method(params):
SmartHome.send({
'target': 'led',
'cmd': 'led_hello',
})
voice = text = ''
return Response(text = text, voice = voice)
patterns = []
led_hello = SmartHome('led_hello', patterns)
led_hello.setStart(method)
################################################################################

View File

@ -1,15 +0,0 @@
from .SmartHome import *
from ArchieCore import Response
################################################################################
def method(params):
SmartHome.send({
'target': 'main_light',
'cmd': 'light_on',
})
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (включ|выключ)* свет *']
main_light = SmartHome('main_light', patterns)
main_light.setStart(method)

View File

@ -1,8 +1,10 @@
from .SmartHome import *
from Command import Response
from .SmartHome import SmartHome
from Command import Command, Response
################################################################################
def method(params):
@Command.new(['(открыть|открой) (окно|окна)', ' подними|поднять) (шторы|роллеты)'])
def windowOpen(params):
SmartHome.send({
'target': 'window',
'cmd': 'window_open',
@ -10,20 +12,13 @@ def method(params):
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (открыть|открой) (окно|окна) *', '* (подними|поднять) (шторы|роллеты) *']
window_open = SmartHome('window_open', patterns)
window_open.setStart(method)
################################################################################
def method(params):
@Command.new(['(закрыть|закрой) (окно|окна)', '(опусти|опустить) (шторы|роллеты)'])
def windowClose(params):
SmartHome.send({
'target': 'window',
'cmd': 'window_close',
})
voice = text = ''
return Response(text = text, voice = voice)
patterns = ['* (закрыть|закрой) (окно|окна) *', '* (опусти|опустить) (шторы|роллеты) *']
window_close = SmartHome('window_close', patterns)
window_close.setStart(method)

View File

@ -1,18 +1,14 @@
from ArchieCore import Command, Response # import parent class
import urllib.request
import xlrd
import xlwt
from xlutils.copy import copy
from datetime import datetime, timedelta
class Zieit (Command):
class Zieit:
lessonsStartTime = ['08:00', '09:30', '11:10', '12:40', '14:10', '15:50', '17:20']
lessonsEndTime = ['09:20', '10:50', '12:30', '14:00', '15:30', '17:10', '18:40']
weekdays = ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
def start(self, string): # main method
pass
@classmethod
def getShedule(self):
url = 'https://www.zieit.edu.ua/wp-content/uploads/Rozklad/3k.xls'

View File

@ -1,4 +1,5 @@
from .Zieit import *
from ArchieCore import Command, Response
from .Zieit import Zieit
def formatLesson(lesson):
if lesson == None: voice = text = 'Сегодня пар нет'
@ -28,46 +29,26 @@ def formatDay(lessons):
text += Zieit.fullNames(f'\n{index}. [{time}] {subject}\n....{type} ({auditory})\n....') + teacher
return Response(text = text, voice = voice)
################################################################################
def nextLessonFunc(params):
@Command.new(['следующ* (предмет|урок|пара)'])
def nextLesson(params):
return formatLesson(Zieit.getNextLesson(Zieit.lessonsStartTime))
patterns = ['* следующ* (предмет|урок|пара)']
nextLesson = Zieit('Next Lesson', patterns)
nextLesson.setStart(nextLessonFunc)
################################################################################
def currentLessonFunc(params):
@Command.new(['(текущ*|сейчас) (предмет|урок|пара)'])
def currentLesson(params):
return formatLesson(Zieit.getNextLesson(Zieit.lessonsEndTime))
patterns = ['* (текущ*|сейчас) (предмет|урок|пара)']
currentLesson = Zieit('Current Lesson', patterns)
currentLesson.setStart(currentLessonFunc)
################################################################################
def todaysSheduleFunc(params):
@Command.new(['сегодня (предметы|уроки|пары|расписание)', '* (предметы|уроки|пары|расписание) * сегодня'])
def todaysShedule(params):
if lessons := Zieit.getTodaysShedule():
return formatDay(lessons)
else:
text = voice = 'Сегодня пар нет'
return Response(text = text, voice = voice)
patterns = ['* сегодня (предметы|уроки|пары|расписание)', '* (предметы|уроки|пары|расписание) * сегодня *']
todaysShedule = Zieit('Todays Shedule', patterns)
todaysShedule.setStart(todaysSheduleFunc)
################################################################################
def tomorrowsSheduleFunc(params):
@Command.new(['завтра (предметы|уроки|пары|расписание)', '* (предметы|уроки|пары|расписание) * завтра'])
def tomorrowsShedule(params):
if lessons := Zieit.getTomorrowsShedule():
return formatDay(lessons)
else:
text = voice = 'Завтра пар нет'
return Response(text = text, voice = voice)
patterns = ['* завтра (предметы|уроки|пары|расписание)', '* (предметы|уроки|пары|расписание) * завтра *']
tomorrowsShedule = Zieit('Todays Shedule', patterns)
tomorrowsShedule.setStart(tomorrowsSheduleFunc)

View File

@ -1,4 +1,4 @@
from .Media import Media
# from .Media import Media
from .QA.QA import QA
from .SmallTalk import SmallTalk
from .Raspi import Raspi