I am building a Custom Skill of my own. The File Structure format is as per GitHub - MycroftAI/skill-stock: Mycroft AI official Stock Skill - providing current prices of stocks
However every time my skill responds with I do not understand. Any help is much appreciated!
The skill is supposed to return the Username. Find the relevant details (File names & their contents) below;
File Structure
UsernameKeyword.voc
user details
username
login.dialog
Your Username is {{username}}
not.found.dialog
Sorry your Username could not be found
My source did not reply to me
test/intent/login1.json
{
“utterance”: “Give me my Username”,
“intent_type”: “login_intent”,
“intent”: {
“UsernameKeyword”: “username”
}
}
test/intent/login2.json
{
“utterance”: “Give me my Username”,
“intent_type”: “login_intent”,
“intent”: {
“UsernameKeyword”: “user details”
}
}
init.py
import requests
from os.path import dirname
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
class LoginSkill ( MycroftSkill ):
@intent_handler ( IntentBuilder ( “” )
.require ( “UsernameKeyword” ) )
def login_intent ( self , message ):
uname = message.data.get ( “UsernameKeyword” )
try:
response = self.find_and_query (uname)
self.speak_dialog ( “login” , data=response )
except Exception as e:
self.log.exception ( e )
self.speak_dialog ( “not.found”)
def find_and_query(uname):
url = "URL_HERE"
headers = {'Content-Type': 'application/json'}
data = {'KEY1': 'VALUE1' , 'KEY2': 'VALUE2' , 'KEY3': VALUE3 , 'KEY4': VALUE4 ,
'KEY5': 'VALUE5'}
response = requests.post ( url , data , headers )
finalresponse = response.json ( )
username = finalresponse[ 'data' ][ 0 ][ 'dsm_name' ]
return username
def stop ( self ):
pass
def create_skill ( ):
return LoginSkill ( )