Skip to content

tom-snow/PyroEdgeGPTBot

Repository files navigation

PyroEdgeGPTBot

A telegram bot with Bing AI ( using EdgeGPT API )

English - 中文

Features

  • Multiple users with different sessions (No group support now)
  • Response with reference (and correct ref label)
  • Response with normal and stream mode
  • Can allow every one to use
  • Allow you set your own cookie at runtime
  • Allow you set a bot name to you
  • Prompt Support
  • Image generation (inline query and command mode)
  • Export conversation to Notion
  • Hot update the EdgeGPT dependence

Setup

Requirements

Checking bing AI access (Required)

PS: Everyone can access Bing AI for chat now, even anonymous users.

  • Install the latest version of Microsoft Edge
  • Alternatively, you can use any browser and set the user-agent to look like you're using Edge. You can do this easily with an extension like "User-Agent Switcher and Manager" for Chrome and Firefox.
  • Open bing.com/chat
  • If you see a chat feature, you are good to go

Getting authentication (Optional)

PS: This column is needed by image creator, or ask more questions and have longer conversations

  • Install the cookie editor extension for Chrome or Firefox or Edge
  • Go to bing.com
  • Open the extension
  • Click "Export" on the bottom right, then "Export as JSON" (This saves your cookies to clipboard)
  • Paste your cookies into a file ./cookie.json (The filename depends on your .env settings)

Install requirements

pip install -r requirements.txt

Set environment variables

cp .env.example .env

Then edit .env file and set API_ID, API_KEY, BOT_TOKEN and ALLOWED_USER_IDS. Or you can set environment variables like this:

export API_ID='1234567'
export API_KEY='abcdefg2hijk5lmnopq8rstuvwxyz9'
export BOT_TOKEN='123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'
export ALLOWED_USER_IDS='112113115,567568569'

Run

python PyroEdgeGptBot.py

Run it on Back4app

  • Fork this repo
  • Login into Back4app (Suggests login with github account)
  • Click Build new app and Containers as a Service
  • Link the repo you forked.
  • Set the Required ENVS (Explain here)

Note that you can run python base64_encode_cookie.py locally then get COOKIE_BASE64 value from base64_encoded_cookie.txt

  • Deploy!

Run it on Railway (Recommend)

Deploy on Railway

(Optional) Set bot commands

  • Contact @botfather
  • Send /mybots then select your bot and click Edit Bot -> Edit Commands
  • Paste below and send.
start - Start the bot!
help - Get help
reset - Reset the bot
new - Create new conversation
switch - Switch the conversation style
interval - Set edit interval
suggest_mode - Set the suggest mode
image_gen - Generate images
update - Update the EdgeGPT dependence
cookie - Set you own cookie
bot_name - Set the bot name display to you

About

A telegram bot with Bing AI ( using EdgeGPT API )

Resources

License

Stars

Watchers

Forks

Packages

No packages published