Tiesitkö, että Bot Libre tarjoaa myös ilmaisia isännöityjä foorumeita omalle verkkosivustollesi tai mobiilisovellukseen?
Self, AIML, and scripting : Why does this not work

RE: Why does this not work

tekijä admin Lähetetty May 12, 9:28

Looking at your bot I see several issues.

First you have learning enabled, this is not recommend and will make the bot learn EVERY reply you give it as a new response.

For your scripts, the best way to debug a script is to click on the "debug" checkbox in chat and set the log level to FINE. This would give you,

WARNING -- Language:Missing function: requestJSON on: <509 #null *,a:1,c:0,p>
This means the class or method you are using is wrong. This is because you are using http not Http.

Fixing this gives you the error,

WARNING -- Http:Illegal character in path at index 56: https://services.nvd.nist.gov/rest/json/cve/1.0/CVE-3033 - 39315
This is because space characters are not allowed in URLs, you need to encode URL parameters.

Also traversing a deep JSON object can be tricky, I would debug it by traversing 1 level at a time and printing the result. If you traverse nested array elements you need to use "elements" in Self.

Try something like:

state getCVE {
    pattern "(what) (was is) [CVE CVE-ID ID] *" template foo();
    function foo() {
        temp = Http.requestJSON("https://cve.circl.lu/api/CVE-" + Http.encode(star.toString().replace(" ", "")) );
       //severityIs = temp.result.CVE_Items[0].impact.baseMetricV3.cvssV3.baseSeverity
       descIs = temp.result.CVE_Items.elements.[0].cve.description.description_data.elements.[0].value
       if (temp == null) {
           return "I don't think so";
        }
       return (descIs);
    }
}


Id: 43022773
Lähetetty: May 12, 9:28
Päivitetty: May 12, 9:30
Vastaukset: 0
Näkymät: 138, Tänään: 2, Viikolla: 2, Kuukausi: 6
0 0 0.0/5