A Telegram bot that utilizes the power of ChatGPT to provide users with intelligent and engaging responses.
I'm using telegram bot template from cvzi/telegram-bot-cloudflare and simply call API to chatgpt as a response. With this bot, users can engage in natural language conversations and receive personalized responses that are tailored to their specific needs. (generated by ChatGPT)
You can deploy this bot to cloudflare worker with tutorial from cvzi.
To deploy the bot, you required to have:
- Telegram Bot (from: @BotFather)
- Cloudflare Account
- OpenAI API Key
- Create Telegram bot via @BotFather on Telegram
- Create Cloudflare Worker (Follow the steps by cvzi)
- Create Workers KV with name
messages
- Bind the KV with workers via Worker's Setting -> Tab Variables -> KV Namespace Bindings
- Use variable name
MESSAGES
and choosemessages
KV Namespace, then press Save and deploy - Quick edit the worker, and copy bot.js to the Cloudflare code editor
- Edit the
TELEGRAM
andOPENAI
config in te code. - Register webhook and try the bot✨
- Add two commands to the bot via BotFather (/start to start the bot and /clear to reset the conversation)