@logic-panda/sdk
v1.2.2
Published
LogicPanda AI + Javascript SDK
Downloads
10
Maintainers
Readme
LogicPanda AI + Javascript SDK
Easily create text bots that humans can chat with on their preferred messaging platform.
-- ai.logicpanda.app
Installation
$ npm install @logic-panda/sdk
Integrations
Telegraf integration example
import Telegraf from 'telegraf';
import { TelegrafPanda } from '@logic-panda/sdk/integrations'
const telegraf = new Telegraf(BOT_TOKEN)
const panda = new TelegrafPanda(APP_KEY)
telegraf.on('text', (ctx) => {
return panda.getMeaning(ctx.message.text)
.then((result) => {
// reply to user with wit result
return ctx.reply(JSON.stringify(result, null, 2))
})
})
telegraf.startPolling()
There are some other examples.
Error Handling
To perform custom error-handling, you can set onError
handler:
panda.on('error', (ctx) => {
console.error('error', err)
}