Download the open source Bot Libre Community Edition and install Bot Libre on your own server
Self, AIML, and scripting : Why does this not work

RE: Why does this not work

by admin posted May 12 2022, 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
Posted: May 12 2022, 9:28
Updated: May 12 2022, 9:30
Replies: 0
Views: 975, today: 1, week: 1, month: 72
0 0 0.0/5