Giter VIP home page Giter VIP logo

chatgpt-telegram-bot's Introduction

ChatGPT Telegram Bot

This bot uses simple auth via private Telegram group - bot will not work with users that are not members of some private group.

Prepare

  1. Register at https://platform.openai.com/
  2. Create new API key: https://platform.openai.com/account/api-keys. Save it somewhere.
  3. Create telegram bot via message to https://t.me/BotFather. Save bot token somewhere.
  4. Create private group and add bot to it. Save somewhere ID of the group (ex. '-123456789'). You can find group ID in Telegram Web by opening the group and get ID from URL - like https://web.telegram.org/k/#-123456789, where ID is -123456789
  5. Add trusted users to private group you created.
  6. (optional) Create .env file with variables you need.

Usage

You can set TELEGRAM_AUTH_GROUP_ID, TELEGRAM_BOT_TOKEN, OPENAI_API_KEY in your env.

Or you can pass it to node directly.

Shell

TELEGRAM_AUTH_GROUP_ID='...' TELEGRAM_BOT_TOKEN='...' OPENAI_API_KEY='...' node server.js

Full env list

env name default description
TELEGRAM_AUTH_GROUP_ID
(required)
undefined id of private telegram group. Ex. '-123456789'
TELEGRAM_BOT_TOKEN
(required)
undefined telegram bot token
OPENAI_API_KEY
(required)
undefined
TELEGRAM_BOT_ALIAS undefined telegram bot username. Ex. '@your_bot_username'
TELEGRAM_ADMIN_NICKNAME undefined Ex. '@your_user'
MAX_MODEL_TOKENS 100
MAX_RESPONSE_TOKENS 500
THROTTLE_INTERVAL 20
CONVERSATIONS_TIMEOUT 604800000 timeout before conversation will be cleaned, in ms

Docker

docker run --rm -d \
 -e TELEGRAM_AUTH_GROUP_ID='...' \
 -e TELEGRAM_BOT_TOKEN='...' \
 -e OPENAI_API_KEY='...'\
 kemmor/chatgpt-telegram-bot:latest

License

The MIT License (MIT)

chatgpt-telegram-bot's People

Contributors

ryllaz avatar

Watchers

 avatar

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.