How do i send a message to the messagebus?


#1

hello

im reading the messagebus documentation and it says that its possible to send an utterance to the messagebus. which particular function makes that possible?


#2

I think the docs are a bit outdated as it describes uses og self.emitter.emit() but I think the right would be to use self.bus.emit

def some_method(self):  
    self.bus.emit(Message("recognizer_loop:utterance",  
                              {'utterances': ["inject a user utterance"],  
                               'lang': 'en-us'}))  

#3

Hey andlo,

I was also looking for something similar. I was wondering… does this method store the utterance in the memory? Would it be possible to match this utterance against other intents in mycroft core as well?

Thanks!


#4

When sending a utterance to the messagebus, and other skills will match and react to it.

So if you add a

self.bus.emit(Message("recognizer_loop:utterance",  
                              {'utterances': "Play rainy day"],  
                               'lang': 'en-us'}))  

at the end of the weather-skill and the ask mycroft “how is the wether” he will tell you the weatherforcast by using the weather-skill and then play Rainy day by using a music skill.