Python:
class DiAffirmations(Skill):
# plays start up sound and removes skill
def __init__(self):
super().__init__()
self.replacers: dict[str,DrawRnd] = {"relaxingthing": DrawRnd("drink tea", "play video game", "watch anime")}
self.affirmations: Responder = Responder("make sure to relaxingthing", "its fun to relaxingthing isn't it?", "relaxingthingmaxing is based")
self.pause: bool = False
self.isActive: bool = False
def input(self, ear: str, skin: str, eye: str):
if not self.isActive and ear == "affirmations":
self.isActive = True
self.setSimpleAlg("starting affirmations")
return
if self.isActive and ear == "stop":
self.isActive = False
self.setSimpleAlg("stopping affirmations")
return
if not self.isActive:
return
if self.pause:
self.pause = False
return
affirmation:str = self.affirmations.getAResponse()
for key in sorted(self.replacers.keys(), key=len, reverse=True):
affirmation = affirmation.replace(key, self.replacers[key].renewableDraw())
self.setSimpleAlg(affirmation)
self.pause = True