Quora的Poe的反向工程节点端。
支持:获取所需信息并写入.ENV文件|将消息发送到其他机器人|设置代理|清除/删除/清除消息|获取历史记录消息|获取机器人信息|获取下一个数据
我仍在努力,所以它可能不稳定。如果您遇到任何问题,请创建一个问题。
npm install poe-node-api要求:
- 节点> = 18
- .env:要存储所需的参数,例如
poe-formkey/cookie/buildId/ botid .....
从poe.com获取cookie:f12/Inspect,应用程序> cookie> https://poe.com> pb
在项目root路径中创建.ENV文件,然后将cookie添加到.env文件中
cookie = p-b=xxxxxxxxxxxxxxxxxxxxxxxxxxx const client = new PoeClient ( { logLevel : 'debug' } ) ;
await client . init ( )
// If no poe-formkey and buildId in .env file, client will download needed params, next time will not need to fetch these params again until cookie is changed/logout(For now).如何创建客户:
import { PoeClient } from "poe-node-api" ;
const client = new PoeClient ( { logLevel : 'debug' } ) ;如何启动客户
await client . init ( )buildId / poe-formkey之类的必要参数,并在本地'.env'文件中覆盖它们。为了防止冲突,使用多学院时,您应该将
rewriteToLocalEnvFile设置为False
机器人昵称
botnickname <==> botdisplayname
- A2 <==> Claude-Instant
- A2_2 <==> Claude+
- 海狸<==> gpt-4
- Capybara <==> Sage
- nutria <==>蜻蜓
- Chinchilla <==> chatgpt
- Hutia <==> Neevaai
- 您自己的机器人
/**
* send message to bot
* @param text user input
* @param botNickName bot nick name, like capybara(Sage) / a2(Claude-instant) / a2_2(Claude+) etc.
* @param withChatBreak Add a chat break or not. (Empty context)
* @param callback When ws on message, will invoke this callback function.
*/
await client . sendMessage ( text , botNickName , withChatBreak , ( result : string ) => { console . log ( ` ${ result } ` ) } )文字:字符串
botnickname:字符串
与Chatbreak:布尔值
回调:(结果:字符串)=> void
警告:一分钟内太多请求将导致(免费)帐户被阻止!!!!
我在一分钟内发送了大约20条消息,现在它被阻止了。错误消息失败:
Something went wrong. Please wait a moment and try again.因此,请确保您知道自己在做什么〜
const res = await client . addChatBreak ( botNickName ) ; const res = await client . deleteMessage ( messageIds ) ; const res = await client . purgeAllMessage ( ) ;删除所有机器人消息,等于单击POE.com>设置>删除所有消息
const history = await client . getHistory ( botNickName , count ) ; const history = await client . getBotByNickName ( botNickName , retryCount , retryIntervalMs ) ; const history = await client . getNextData ( ) ;可以获取
poe-formkey/buildId/latest messages(例如最新5条消息)和startCursor(使用startcursor来获取历史记录消息) /availableBots/x-forwarded-for/ .....
await client . updateAllBotInfo ( )此功能将获取POE-FORMKEY,buildID,最新消息,启动器和所有bot Info(chatid / id,这两个参数将用于使用)。
此功能将将
poe-formkey/cookie/buildId/${botDisplayName}_chatId和${botDisplayName}_id设置为.env file(这些参数与cookie相同,并且不需要每次要求)。下次您将MSG发送到任何机器人时,将不需要再次获取bot信息,客户端将获得所需的params,例如
buildId从local .env文件中获得。
示例-SendMessage.ts
示例-SendMessage.ts
示例-troxy.ts
示例-Thistory.ts
示例-FetchallneededInfo.ts
麻省理工学院