Is it possible to combine two skills together?

I want Mycroft to check if the user’s sentence is meeting some requirements in the first skill, if the sentence spoken by the user fulfills the requirements from the first skill, I want Mycroft to proceed with the second skill.

For example- “Tell me the weather today 1 2 3” (this is just an example)

First skill- Checks if the user phrase has numbers in the sentence (1, 2, 3 in this case)

Second skill- Tell weather, only if the user skill has 1 2 3 in the phrase.

“Roll a dice 1 2 3” should also work similarly, in short, all other skills should work with the first skill. I hope the explanation was clear.

HAve a look at @JarbasAl good-manners skill

It will tricker if some word re used and act on it.
So asking “hey mycroft, how is the F***ing weather today” will tell you the weather by the weatherskill and then the good-manners skill will tell you that f***ing isnt a nice word to use.

I think it is something like that you are looking for.

Hey sh77,

The simplest method for personal use would probably be to create a Fallback Skill and use one of the reserved priority handler slots. This would be invoked before Precise/Padatious intent matching. Normally if a Fallback Skill is triggered and can respond it returns True. If it returns False then other skills are given the opportunity to match. There’s more on Fallback Skills in our documentation.

Alternatively, in your use cases, would the secondary skills (eg weather and dice skill) be a fixed set of skills or are you wanting to do this for any skill that is invoked similar to the Good Manners Skill?

If you knew the phrases you are trying to catch, then you would be able to produce a more specific intent match. For example specifically matching “Tell me the weather today 1 2 3” will beat out a skill that is only looking for “Tell me the weather today”. You could then dispatch the slimmed down message “Tell me the weather today” to the messagebus that would be caught by the secondary skill. I’ve never done this but can’t see why it wouldn’t work.

Generally though, Skill invocation is setup so that only one Skill will answer an utterance, which among other things prevents a cascade of responses being spoken at the user.

1 Like

Hey gez,

Thanks for the reply. To answer your question, I would say yes the skill is pretty similar to the good manners skill. So I would probably want the device to respond to almost any kind of question (that is after the first part is satisfactory).

I will look into the fallback skills, and yeah the other idea sounds quite good as well.

Andlo,

Thanks, that’s pretty close to what I want to achieve actually. This skill looks good, I will have a look into it.

1 Like

Hey

Could you tell me how this skill handles the call to another skill? I can’t seem to find it in the code :S

Hi
The goodmanersskill isnt called from other skills - it just listen in what is saied and react on that
It does that bu using the messagebusOne event for listen on the uterance and one event for look for when a skill is finish.

self.add_event("recognizer_loop:utterance", self.ensure_converse)
self.add_event("mycroft.skill.handler.complete", self.handle_output)

That is oneway to do it - you could also register on the messagebus and listen on that. So first skill can call second.

Ive been using that to have one common read story skills, that comunicate with other skills to see if they know a story, and then let them read. That work isnt readdy yet but I did manage to get it working :slight_smile:

A post was split to a new topic: Send Skill responses to Telegram