શું તમે જાણો છો બોટ કાવ્ય પણ પૂરી પાડે છે મફત હોસ્ટ લાઈવ ચેટ માટે તમારી પોતાની વેબસાઇટ અથવા મોબાઇલ એપ્લિકેશન?
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);
    }
}


ને: 43022773
પોસ્ટ: May 12 2022, 9:28
સુધારાશે: May 12 2022, 9:30
જવાબો: 0
જોવાઈ: 928, આજે: 5, સપ્તાહ: 9, મહિને: 25
0 0 0.0/5