Ciyou / chatbot-telegram

Yet another telegram ChatGPT bot which allows you to setup and run your bot with one simple command.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿค–๏ธ chatbot-telegram

Version 1.0.0 License: MIT Twitter: Ciyou

Yet another telegram ChatGPT bot which allows you to setup and run your bot with one simple command. PRs and suggestions are welcome. Leave a ๐ŸŒŸ if you find this project helpful.

โš ๏ธ Warning: The underlying model is currently gpt-3.5-turbo, which is already fine-tuned for conversation but costs money. A new OpenAI account comes with $18 free credit though, which is enough to run this bot for some time.

Support for using a reverse proxy to access the origin ChatGPT will be added soon.

It.s.working.mp4

๐Ÿช„ Features

  • Run your ChatGPT telegram bot with single command.
  • Support group chat by metioning @ bot while bot privacy mode turned off.
  • Reload conversion with /reload command.
  • Support group chat with /chat command while bot privacy mode turned on.
  • Support multiple conversions, unique for each chatID.
  • Support login to OpenAI with password.

๐Ÿ’ฟ Installation

  1. Make sure you have installed Deno already.

    If you don't, follow this official document to install. https://deno.land/manual@v1.28.3/getting_started/installation#download-and-install

  2. Simply git clone or download this repo, cd into the project folder.

  3. Cache dependencies and check integrity with lock.json, you only need to do this once.

deno cache --lock=lock.json chatbot.ts

๐Ÿ”ฎ Usage

  1. Complete Telegram bot token and ChatGPT session token in env.example.
BOT_TOKEN=YOUR_BOT_TOKEN
OPENAI_API_KEY=YOUR_OPENAI_API_KEY

To get your session token, see Get ChatGPT Session Token.

  1. Rename env.example to .env
mv env.example .env
  1. deno run and enjoy!
deno run chatbot.ts

Deno requires you to approve file system reading, enviroment variables access and network access manually. You can also run with these parammeters to give permission by default.

deno run --allow-read --allow-env --allow-net chatbot.ts

๐Ÿ”‘ Get OpenAI API Key

  1. Sign up for an OpenAI account at https://beta.openai.com/signup

  2. Generate a new API key at https://platform.openai.com/account/api-keys. This is your API key, anyone can use it to access your account which may cause unexpected charges. Keep it secret!

  3. Paste it in your .env file.

๐Ÿ’Œ Credits

About

Yet another telegram ChatGPT bot which allows you to setup and run your bot with one simple command.

License:MIT License


Languages

Language:TypeScript 100.0%