chatgptbot

command module
v0.0.0-...-d68ec4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 7 Imported by: 0

README

ChatGPTBot

This repository contains a Go implementation for creating a WhatsApp or Telegram bot to interact with the ChatGPT OpenAI model. When running it will respond to messages sent by a specific user or sent to a specific group (to be configured at the top in main.go).

Some context about the services being used:

Note: everything in this repository is meant for personal and educational use only.

Getting Started

The below instructions assume that you have:

You can run the bot by executing the following command from within the root of the repository:

go run .

Note: authenticating to the ChatGPT API is a bit convoluted since the official OpenAI GPT-3 API doesn't support ChatGPT (at time of writing). When you run the bot it will attempt to fire up a browser session to intercept your JWT token (for this you need chromium-browser installed). If this is failing, you need to manually extract a JWT token of the ChatGPT session (login to https://chat.openai.com/auth/login and use your browser's develop tools to copy the JWT token).

Authenticating to messengers

  • Linking the app as a device in WhatsApp is as easy as using WhatsApp for web. On the first run the a QR-code will be printed to the terminal that needs to be scanned on your phone to give acces (WhatsApp -> Settings -> Linked Devices -> Link a device)
  • For Telegram follow the instructions at https://core.telegram.org/bots/tutorial#obtain-your-bot-token to obtain a bot API token

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL