Closed Milo123459 closed 3 years ago
@IntriguingTiles bump
bump. I want this this be added @IntriguingTiles
at least someone cares hahah
@Milo123459 for now what i do is setting the flag allowJs
to true on the tsc config file to afterward load the module from a js file. it's far from perfect but it does the job. here is how i do it:
./cleverbot-handler.js:
const cleverbot = require("cleverbot-free")
const CleverBotConvoHistory = [];
const SHOULD_USE_CONVO_HISTORY = true;
async function chat_clever(msg) {
const answer = await cleverbot(msg, CleverBotConvoHistory);
if (SHOULD_USE_CONVO_HISTORY)
{
CleverBotConvoHistory.push(msg);
CleverBotConvoHistory.push(answer);
}
return answer;
}
export default chat_clever;
index.ts:
import { chat_clever } from "./cleverbo-handler.js";
chat_clever("Hello!").then(console.log)
Hello! This is a pull request that add's typings and uses yarn.lock instead of package-lock.json This is mainly focused on typings, but yarn can be seen as a "helpful" addition.