જોડાવા બોટ કાવ્ય માતાનો જીવનસાથી અને સંલગ્ન કાર્યક્રમ અને આધાર આપે છે અમારા મફત ઓપન પ્લેટફોર્મ
Self, AIML, and scripting : Why does this not work

RE: Why does this not work

દ્વારા dewhite57 પોસ્ટ May 12 2022, 11:27

I figured it out the .elements.[0] does not work.  But, if you use this syntax:

conversation.topic.description = resp.result.CVE_Items.get(#element, 0).cve.description.description_data.get(#element, 0).value;

it returns the nested string description.  So, the whole script which retrieves a description of a CVE inquiry is:

state cveLookUp {
pattern "(what) (was is) (CVE) *" template getCVE();

function getCVE() {
resp = Http.requestJSON("https://services.nvd.nist.gov/rest/json/cve/1.0/CVE-" + Http.encode(star.toString().replace(" ", "")));
conversation.topic = star.toString();
conversation.topic.description = resp.result.CVE_Items.get(#element, 0).cve.description.description_data.get(#element, 0).value;

if (conversation.topic.description == null){
output = "CVE " + converstion.topic + " does not exist";
} else {
output = "CVE-" + conversation.topic + " is dedscribed as: " + conversation.topic.description;
}
return output;
}
}

Thanks


ને: 43023882
પોસ્ટ: May 12 2022, 11:27
જવાબો: 0
જોવાઈ: 584, આજે: 1, સપ્તાહ: 7, મહિને: 15
0 0 0.0/5