Giter Site home page Giter Site logo

poe's Introduction

UPDATE:

30 March 2023: Quora Poe has updated their mail filter, so the auto login feature by Guerrilla Mail as temporary email service is not working anymore. I will try to find another temporary email service to replace it.

Quora Poe

This is a tool to call the Quora Poe API through GraphQL. It is a work in progress, and currently supports the following:

  • Auto login using temporary email, so you don't need to use your own email/phone number.
  • Manual login using your own email/phone number, you need to enter the OTP manually.
  • Chat with 4 types of bots (Sage, Claude, ChatGPT, and Dragonfly).
  • Stream responses support from the bot.
  • Clear the chat history.
  • Auto re-login after session expires (only for auto login).
  • Module support, now you can use this tool as a module.
  • Chat history
  • Prompt from file
  • Delete messages

Demo's

CLI

CLI demo

Client module (after login)

Client Demo after login

Client module (before login)

Client Demo before login

Client module (auto re-login after session expires)

Client Demo re-login after session expires

Requirements

  • NodeJS 16.0.0 or higher
  • NPM

Installation

  • Copy the config.example.json file to config.json
  • Run the following command to install the dependencies:
npm install

Usage

Module

Please see file ./src/client_auto.ts or ./src/client_manual.ts for example. Or you can try to run the following command:

node ./dist/client_auto.js

CLI

npm run cli

If you don't want stream responses, you can change the stream_response variable in the config.json file to false.

TODO List

  • Find another temp mail service for login automation

Notes

  • Since I have to work on this project in my free time, I can't guarantee that I will be able to update this project frequently.
  • I'm not have much experience with TypeScript, so if you have any suggestions, best practices, or anything, please let me know or create a pull request.
  • I'm not publishing this tool to NPM yet. If you want to use this tool as a module, you can clone this repo and build it yourself.
  • If you have any questions, please create an issue.

Contributing

To contribute to this repo, fork it first, then create a new branch, and create a pull request.

Disclaimer

This tool is not affiliated with Quora in any way. I am not responsible for any misuse of this tool. Don't sue me.

Also, please don't use auto login feature to spam the bot, like creating a lot of accounts for any purpose. I don't want this temporary email service to be banned.

License

Apache 2.0

poe's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

poe's Issues

UI for mobile?

What's the best way to get a ui running for this on mobile? Honestly Poe didn't have an exceptional UI so just something equal to it at a minimum.
Ideally i would want one to run locally on my burner. "Off the grid" is still a dream ya know

undefined:1

D:\Ai\Poe\poe> node ./dist/client_auto.js
undefined:1

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at new ChatBot (file:///D:/Ai/Poe/poe/dist/index.js:26:28)
at file:///D:/Ai/Poe/poe/dist/client_auto.js:2:13
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Node.js v18.16.0

sendVerificationCodeMutation not working

Okay, so I have tested manually if the https://github.com/cemalgnlts/Mailjs would work as a new service for email.
Doing the steps by hand, works just fine, and I even initialized the changes on the project at the mail file.
The problem is: The mutation to try and send the verification code is not working and i coulddnt get it to work at all.
If anyone can help me get it to work, I can manage to update the mail config to the auto email login and renew function

has been achieved : Updated on 30 march 2023, auto login currently not available #11

The following is a new email address, and I have implemented it, it can be used directly, but POE will now return
{"data":null,"errors":[{"message":"Server Error"}],"extensions":{"is_final":true}}
I have never solved this.

import fetch from "cross-fetch";
import {readFileSync, writeFile} from "fs";

const createNewEmail = async () => {
    const name = "poe" + Date.parse(new Date().toString()) + Math.random();
    const response = await fetch(`https://maildrop.cc/page-data/inbox/page-data.json?mailbox=` + name);
    const response_json = await response.json();
    let credentials = JSON.parse(readFileSync("config.json", "utf8"));
    if (!credentials) {
        credentials = {}
    }
    credentials.email = name + "@maildrop.cc";
    writeFile("config.json", JSON.stringify(credentials), function (err) {
        if (err) {
            console.log(err);
        }
    });
    return {
        email: credentials.email,
        sid_token: name
    }
}

const getEmailList = async (email) => {
    let request = {
        operationName: 'GetInbox',
        query: "query GetInbox($mailbox: String!) {\n  ping(message: \"Test\")\n  inbox(mailbox: $mailbox) {\n    id\n    subject\n    date\n    headerfrom\n    __typename\n  }\n  altinbox(mailbox: $mailbox)\n}\n",
        variables: {
            mailbox: email,
        },
    }
    const response = await fetch(`https://api.maildrop.cc/graphql`, {
        method: 'POST',
        headers: {'Content-Type': 'application/json',},
        body: JSON.stringify(request)
    });
    console.log("email=" + email)
    const response_json = await response.json();
    return {
        list: response_json.data.inbox,
    }
}

const getLatestEmail = async (sid_token) => {
    let emailList = await getEmailList(sid_token);
    let emailListLength = emailList.list.length;
    if (emailListLength == 0) {
        for (let i = 0; i < 30; i++) {
            await new Promise(r => setTimeout(r, 1000));
            emailList = await getEmailList(sid_token);
            emailListLength = emailList.list.length;
            console.log("emailListLength = " + emailListLength);
            if (emailListLength > 0) {
                break;
            }
        }
    }
    return emailList.list[0].id;
}

const getCodeId = async (name, id) => {
    console.log("name", name, "id", id)
    let request = {
        operationName: 'GetMessage',
        query: "query GetMessage($mailbox: String!, $id: String!) {message(mailbox: $mailbox, id: $id) {html\n}}",
        variables: {
            mailbox: name,
            id: id
        },
    }
    const response = await fetch(`https://api.maildrop.cc/graphql`, {
        method: 'POST',
        headers: {'Content-Type': 'application/json',},
        body: JSON.stringify(request)
    });
    const response_json = await response.json();
    return response_json.data.message.html
}

const getPoeOTPCode = async (email_name) => {
    const emailDataId = await getLatestEmail(email_name)
    let codeHtml = await getCodeId(email_name, emailDataId)
    codeHtml = codeHtml.replace("\r\n", "")
    let patt = new RegExp(/>\d{6}</g)
    let arr = codeHtml.match(patt);
    let code = arr[0].substring(1, 7)
    console.log("emailData", code);
    console.log("OTP CODE: " + code);
    return code;
}

export {
    createNewEmail,
    getLatestEmail,
    getPoeOTPCode
}

Unable to login

> [email protected] cli
> node ./dist/cli.js

√ Select » Semi-Auto [Use you own email/phone number]

...\poe\node_modules\cross-fetch\node_modules\node-fetch\lib\index.js:273
                                return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
                                                           ^
FetchError: invalid json response body at https://poe.com/api/gql_POST reason: Unexpected token < in JSON at position 0
    at D:\AI\poe\node_modules\cross-fetch\node_modules\node-fetch\lib\index.js:273:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ChatBot.makeRequest (file:///D:/AI/poe/dist/index.js:114:16)
    at async ChatBot.subscribe (file:///D:/AI/poe/dist/index.js:106:9)
    at async ChatBot.startCli (file:///D:/AI/poe/dist/index.js:433:13)
    at async file:///D:/AI/poe/dist/cli.js:3:1 {
  type: 'invalid-json'
}

Node.js v18.17.1

Add a License

This would provide certainty for developers who want to use the software in their projects. I personally use Apache-2.0 for all my projects. MIT, BSD-3-Clause, or GPL-3 are other common choices. Here's a table of their tradeoffs: https://choosealicense.com/appendix/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.