• Stars
    star
    1,666
  • Rank 27,923 (Top 0.6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is a very early attempt at having chatGPT work within a telegram bot

BREAKING: ChatGPT API was just released, going to update this repo to use it! We're back baby!

ChatGPT Telegram Bot

CleanShot 2022-12-02 at 16 08 27

This is a Telegram bot that lets you chat with the chatGPT language model using your local browser. The bot uses Playwright to run chatGPT in Chromium, and can parse code and text, as well as send messages. It also includes a /draw command that allows you to generate pictures using stable diffusion. More features are coming soon.

Features

  • Chat with chatGPT from your Telegram on the go
  • /draw pictures using stable diffusion (version 0.0.2)
  • /browse give chatGPT access to Google (version 0.0.3)

How to Install

Step 1: Install Python and Miniconda

  1. Go to the Miniconda download page.
  2. Click on the appropriate installer for your operating system.
  3. Follow the prompts to complete the installation.

Step 2: Create a conda environment

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you want to create the environment.
  3. Run conda env create -f environment.yml to create the environment.
  4. Activate the newly created environment conda activate chat

Step 3: Install Playwright

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you installed Miniconda.
  3. Run playwright install to download the necessary Chromium software.
  4. Run playwright install-deps to download the necessary dependencies

Step 4: Set up your Telegram bot

  1. Set up your Telegram bot token and user ID in the .env file. See these instructions for more information on how to do this.

How to obtain telegram user id? Add telegram userinfobot to your telegram contacts

  1. Edit the .env.example file, rename it to .env, and place your values in the appropriate fields.

Step 5: Set up your API keys

  1. Copy the .env.example file and rename the copy to .env.
  2. To use the /draw command, you will need to obtain an API key for stable diffusion. To do this, go to Dream Studio Beta and sign up for a free membership.
  3. SERP_API_KEY is optional. If you want to use the /browse command, you will need to obtain an API key for SERP. To do this, go to SERP API and sign up for a free account.

Step 5: Run the server

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you installed the ChatGPT Telegram bot.
  3. Run python server.py to start the server.

Step 6: Chat with your bot in Telegram

  1. Open the Telegram app on your device.
  2. Find your bot in the list of contacts (you should have already created it with @botfather).
  3. Start chatting with your bot.

If you're using Docker inside a server (headless mode)

You can use the docker image to launch your bot in a server (using playwright headless mode)

docker-compose example

services:
  chatgpt-telegram-bot:
    image: ghcr.io/altryne/chatgpt-telegram-bot
    container_name: chatgpt-telegram-bot
    environment:
      - TELEGRAM_API_KEY=
      - TELEGRAM_USER_ID= #Use this with your user ID to restrict usage only to your account
      - STABILITY_API_KEY= #use this if you want the bot to draw things with stability AI as well
      - SERP_API_KEY= #add this from serpapi if you want to enable the google search feature
      - OPEN_AI_EMAIL= #openai login email. Needed for autologin in headless mode
      - OPEN_AI_PASSWORD= #openai password. Needed for autologin in headless mode

Credits

More Repositories

1

awesome-ai-art-image-synthesis

A list of awesome tools, ideas, prompt engineering tools, colabs, models, and helpers for the prompt designer playing with aiArt and image synthesis. Covers Dalle2, MidJourney, StableDiffusion, and open source tools.
1,704
star
2

sd-webui-colab

A repo for the maintenance of the Colab version of stable-diffusion-webui repo
Jupyter Notebook
505
star
3

Ipad-Simulator

jQuery + css3 iOS simulator with some ipad design
JavaScript
228
star
4

install_apps_alfred

##Install mac apps with alfred
Python
30
star
5

pocket_alfred

Alfred pocket workflow using oAuth 2.0
Python
11
star
6

Github-diff-extension

Awesome chrome extension to help with yor github diff
JavaScript
10
star
7

aelios

Html5 aelios clone
JavaScript
9
star
8

compare-claude-caching

Compare Anthropic Claude with caching and without
Jupyter Notebook
9
star
9

blisscontrol

Control all your social accounts with one go
JavaScript
6
star
10

google-plus-api

Workaround for sharing stuff on google+ programatically
JavaScript
5
star
11

chrome-extensions

My chrome extensions repo
JavaScript
5
star
12

hubot-caniuse

A caniuse command for hubot
CoffeeScript
5
star
13

compare-llama-providers

Check if all Llama providers are the same
Jupyter Notebook
5
star
14

hubot-insulter

A hubot script to insult/compliment someone for you
CoffeeScript
4
star
15

remote_volume_control_workflow

Use Alfred App remote to control volume on your mac
3
star
16

relationbook

just a couple game
JavaScript
2
star
17

altryne.github.com

my github page repo
2
star
18

profiles_game

how well do you know your friends
JavaScript
2
star
19

whisper-me-this-ticket

A repo for transcribing videos using whisper
Python
1
star
20

langchain_space

code space running a langchain
1
star
21

youtrack_alfred

Python
1
star
22

track-nebraska

A simple project using cypress.io tracking the nebraska UCSIC office process dates
JavaScript
1
star
23

nomosoap.com

JavaScript
1
star
24

timezonify

TypeScript
1
star
25

jamstack-template

HTML
1
star
26

scrolluminati2

JavaScript
1
star
27

quicktimer

Quicktimer is the quickest way to set a timer on your browser
JavaScript
1
star
28

html5il-theme

A theme for html5il.com
PHP
1
star
29

tut-linker

A way to tweet toots (or rather usernames) - preserves the mastodon SEO tags so twitter can show relevant info
TypeScript
1
star
30

html5-il-site

A simple angular website with a hoock to meetup.com API with authentication
JavaScript
1
star