npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poe-npm

v1.1.0

Published

A Node.js package for interacting with the Quora Poe chatbots, including custom chatbots. Please note that this package is not official and has been reverse-engineered. Use it at your own discretion.

Downloads

18

Readme

Poe-NPM

npm version License: MIT

A Node.js package for Interacting with Poe Chatbots using Reverse Engineering

Installation

npm install poe-npm

Usage

const { setAuth, loadChatId, clearContext, sendMessage, getMessage} = require('poe-npm');

Authentication

Before using the package, you need to set up the authentication by providing the Quora-Formkey and Cookie values. Here's how you can obtain them:

How to get Quora-Formkey and Cookie

  1. Log in to https://quora.com/.
  2. Open the browser console.
  3. Paste the following code to get the value of Quora-Formkey:
    window.ansFrontendGlobals.earlySettings['formkey'];
  4. Go to the Application tab.
  5. Navigate to Cookies > quora.com.
  6. Look for the 'm-b' cookie and use its value as Cookie.
  7. IMPORTANT: Use the same email address to log in to https://poe.com/ or else you will get an error.

Setting the Authentication

const formkey = 'YOUR_FORMKEY';
const cookie = 'M_B_COOKIE_VALUE';

setAuth('Quora-Formkey', formkey);
setAuth('Cookie', `m-b=${cookie}`);

Selecting a Bot

Select the bot you want to interact with by specifying its username:

const bot = 'capybara'; // Example: 'Sage' bot

Refer to the table below to find the appropriate username for the desired bot.

| Bot | Username | | --------- | --------------- | | Sage | capybara | | GPT-4 | beaver | | Claude+ | a2_2 | | Claude | a2 | | ChatGPT | chinchilla | | Dragonfly | nutria | | Other | USERNAME_OF_BOT |

Functions

loadChatId(bot)

Load the chat ID associated with the selected bot.

const chatId = await loadChatId(bot);

clearContext(chatId)

Clear the context of the chat associated with the provided chat ID.

await clearContext(chatId);

sendMessage(bot, chatId, text)

Send a message (text) to the selected bot using the associated chat ID.

const text = 'Hello, Poe!';
sendMessage(bot, chatId, text);

getMessage(bot, chatId)

Get the response message from the selected bot.

const response = await getMessage(bot, chatId);

Example: Using CLI

Step 1. Install package

npm install poe-npm readline-sync

Step 2. Create a file named index.js and paste the following code:

const { setAuth, loadChatId, clearContext, sendMessage, getMessage } = require('poe-npm');
const readlineSync = require('readline-sync');

const formkey = 'YOUR_FORMKEY';
const cookie = 'M_B_COOKIE_VALUE';

setAuth('Quora-Formkey', formkey);
setAuth('Cookie', `m-b=${cookie}`);

const bot = readlineSync.question('Enter Bot\'s Username: ');
console.log('The selected bot is: ', bot);

async function runPoeBot() {
  let chatId = await loadChatId(bot);
  await clearContext(chatId); // clearing context initially

  while (true) {
    const text = readlineSync.question('You: ');

    if (text === 'clear context') {
      await clearContext(chatId);
      console.log('Context cleared');
    }

    await sendMessage(bot, chatId, text);
    const response = await getMessage(bot, chatId);
    console.log(`${bot}: ${response}`);
  }
}

runPoeBot();

Step 3. Run the file using the following command:

node index.js

Disclaimer

Please note that this is not an official package. Use it at your own discretion and adhere to Quora's terms of service and policies.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.