ご存知でしたボットのリブレー無料主催 フォーラム のためにお客様ご自身のウェブサイトまたはモバイルアプリのか?
Self, AIML, and scripting : Why does this not work

RE: Why does this not work

による admin 掲載 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
掲載: May 12 2022, 9:28
更新: May 12 2022, 9:30
回答: 0
眺望: 617, 今日の: 2, 週間: 4, 月: 12
0 0 0.0/5