Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainy

Telegram Chatbot with OpenAI GPT

This project is a Telegram Chatbot that uses OpenAI's GPT language model to generate responses to user messages. The bot can be used in both private conversations and group chats.

Requirements

To use this Chatbot, you'll need the following:

  • A Telegram account
  • A Telegram bot token (you can get one by talking to the BotFather)
  • An OpenAI API key (you can get one by signing up for OpenAI's GPT service)

Installation

To install and run the Chatbot, follow these steps:

  1. Clone this repository to your local machine.
  2. Install the required dependencies using go get

go get github.com/go-telegram-bot-api/telegram-bot-api

  1. Set the following environment variables in config.yml:

telegram_api_key: your-Telegram-bot-token

openai_api_key: your-OpenAI-API-key

  1. Start the Chatbot by running the following command:

go run main.go

Usage

Start new chat with the bot by sending a message to it. The bot will respond with a generated message. You can also add the bot to a group chat and it will respond to messages in the group. For every user or chat ID bot stores some context, size of the context is defined by maxTokens parameter in a ContextManager. Bot recognizes commands in the following format:

ask regular question to the bot, you don`t need to use this command in a private chat, just ask a question

/ask question

set a topic or subject for the bot to talk about, this will be added to the beginning of the generated prompts

/topic some subject

clear the cashed context and topic

/clear

some experimental features to use ChatGPT as a word translator

/cat translate word from Catalan to English

/cas translate word from Spanish to English

bot will respond with a random fact

/hello

bot will respond with a help message, describing the commands

/help

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

This project was inspired by OpenAI's GPT language model and the Telegram Bot API. Thanks to both projects for their great work!

About

Telegram Chatbot that uses OpenAI's GPT

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.