Deploy your own Telegram ChatGPT bot on Cloudflare Workers with ease.
t.me/ChatGPT_Telegram_Workers
English | 中文
- Serverless deployment
- Support for multiple Telegram bots
- Support for multiple OpenAI keys
- Support for Azure OpenAI Service
- Support for Cloudflare AI (free)
- Support for streaming output
- Support for custom roles
- Support for multiple platforms deployment
- How to deploy
- How to set up configuration
- Automatic update
- Support Platform
Deploy your own Telegram ChatGPT bot on Cloudflare Workers with ease.
The simplest and fastest way to deploy your own ChatGPT Telegram bot. Use Cloudflare Workers, single file, copy and paste directly, no dependencies required, no need to configure local development environment, no domain name required, serverless.
You can customize the system initialization information so that your debugged personality never disappears.
example
from https://github.com/TBXark/ChatGPT-Telegram-Workers
--------------------------------------------------------------------------
Thanks to lipeng0820 for providing this video tutorial.
- Open Telegram and send the
/startcommand to BotFather. - Send the
/newbotcommand to BotFather and give your bot a name. - Give your bot a unique username that ends with
_bot. - BotFather will generate a Token. Copy and save this Token. This Token is the secret key that is bound to your bot. Do not disclose it to others!
- Later, in the settings of Cloudflare Workers, fill in this Token in the
TELEGRAM_TOKENvariable.
- Open OpenAI and register an account.
- Click on the avatar in the upper right corner to enter the personal settings page.
- Click on API Keys and create a new API Key.
- Later, in the settings of Cloudflare Workers, fill in this API Key in the
API_KEYvariable.
- Open Cloudflare Workers and register an account.
- Click on
Create a Servicein the upper right corner. - Enter the newly created Workers, select
Quick Edit, copy the../dist/index.jscode into the editor, and save.
- Open Cloudflare Workers, click on your Workers, and click on Setting -> Variables in the upper right corner.
API_KEY: Set it to your OpenAI API Key.TELEGRAM_AVAILABLE_TOKENS: Set it to your Telegram Bot Token.CHAT_WHITE_LIST: Set it to the IDs of users who are allowed to access, for example,123456789,987654321. If you don't know your ID, use the/newcommand to obtain it in conversation with the bot you created.I_AM_A_GENEROUS_PERSON: If you still don't understand how to obtain the ID, you can set this value totrueto turn off the whitelist function and allow everyone to access.
- Click on
Create a Namespaceat the top right corner ofHome-Workers-KV, name it whatever you want, but when binding it, set it asDATABASE.
- Open Cloudflare Workers and click on your Workers.
- Click on
Settingat the top right corner and chooseVariables.
- Click on
Edit variablesunderKV Namespace Bindings. - Click on
Add variable. - Name it
DATABASEand choose the KV data you just created.
- Run
https://workers_name.username.workers.dev/initto automatically bind Telegram webhook and set all commands.
- Start a new conversation by using the
/newcommand. The chat context will be sent to ChatGPT every time. - Modify user settings with the
/setenv KEY=VALUEcommand, for example,SETENV SYSTEM_INIT_MESSAGE=Starting now is Meow, and each sentence ends with Meow. - Since all historical records are carried with each conversation, it
is easy to reach the 4096 token limit, so clear the history by using the
/newcommand when necessary.
- Steps one, two, and three are for manual deployment.
- Run
mv wrangler-example.toml wrangler.tomland modify the corresponding configuration. - Run
npm install - Run
npm run deploy
from https://github.com/TBXark/ChatGPT-Telegram-Workers/blob/master/doc/en/DEPLOY.md






No comments:
Post a Comment