This repository has been archived on 2023-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
jarvis-server/jarvis/skills/entertainement/decide/__init__.py
2021-09-08 14:53:27 +02:00

28 lines
720 B
Python

import random
from jarvis.skills import Skill, SkillRegistering
from jarvis.skills.decorators import intent_file_handler
class DecideSkill(Skill, metaclass=SkillRegistering):
def __init__(self, data=dict):
super().__init__("DecideSkill", data)
@intent_file_handler("decide.intent", "DecideIntent")
def handle_decide_intent(self, data):
print("decide")
if 'choice1' in data and 'choice2' in data:
choice = bool(random.getrandbits(1))
if choice:
self.speak(data['choice1'])
else:
self.speak(data['choice2'])
else:
print("no all choice")
def create_skill(data):
return DecideSkill(data)