realcoloride/node_characterai

how to fix?

Closed this issue · 4 comments

Screenshot_20231119-095834
how to solve this?

Can we see the code?

Could we see the full code? to me it looks like you're continuously authenticating again and again..

Could we see the full code? to me it looks like you're continuously authenticating again and again..

const Telegraf = require("telegraf");
const bot = new Telegraf(token);
const CharacterAI = require("node_characterai");

bot.start((ctx) => {
ctx.reply("Welcome " + ctx.from.first_name);
});

bot.help((ctx) => {
ctx.reply('Available commands:\n/photo - Get a random photo');
});

bot.command('chat', async (ctx) => {
const text = ctx.message.text.split(' ').slice(1).join(' ');
if (!text) return ctx.reply("Bisa Saya Bantu?")

const characterAI = new CharacterAI();
characterAI.puppeteerPath = "/usr/bin/chromium-browser";

if (!characterAI.isAuthenticated()) {
	await characterAI.authenticateWithToken(TOKEN);
}

const characterId = "H2PhghS5pOFdAy4KNtqhaqAIlHgc2X4Z5u1C-1340Q8";
const chat = await characterAI.createOrContinueChat(characterId);

const response = await chat.sendAndAwaitResponse(text, true);
ctx.reply(response);

});

bot.launch();

You are doing the same thing than issue #118 (comment)

Please re-open a new issue in case of new problems