mitsuku-api icon indicating copy to clipboard operation
mitsuku-api copied to clipboard

Getting "Could not parse Mitsuku response" errors... (No published bot with id)

Open ghost opened this issue 5 years ago • 0 comments

Code:

//basically the same from usage example
var mitsuku = require('mitsuku-api')();
mitsuku.send('hello').then(function(response){console.log(response)});

This error occurs @

function parseMessageFromHtml(html) {
    var conv = cheerio.load(html)('body')
        .find('p')
        .text()
        .trim();
    var match = MESSAGE_REGEX.exec(conv),
        message,
        prevMessageStart;
    if (match && match.length > 0) {
        message = match[match.length - 1];
        prevMessageStart = message.indexOf(MESSAGE_SENDER_TAG);
        if (prevMessageStart != -1) {
            message = message.substr(0, prevMessageStart);
        }
        return message.replace(MESSAGE_REJECT_REGEX, '').trim();
    } else {
        throw new Error("Could not parse Mitsuku response");
    }
}

I am using v0.2.1. After I did some console.logs I found this:

<html><title>No bot</title></html><body>No published bot with id=87437a824e345a0d.</body>

ghost avatar Dec 28 '20 03:12 ghost