(reuploaded June 6 2024)
This is my first experiment with TelegramBot and OpenAI APIs. It is a .NET 6 Telegram bot application that integrates with OpenAI for intelligent conversations and generates funny russian quotes. When configured, this bot responds to trigger words.
- TgBot - Main Telegram bot application
- OpenAiInteraction - Library for handling OpenAI API interactions
- .NET 6.0 SDK
- Telegram Bot Token (from @BotFather)
- OpenAI API Key
Microsoft.Extensions.DependencyInjection(8.0.0)Microsoft.Extensions.Hosting(8.0.0)Telegram.Bot(19.0.0)OpenAI(1.10.0)
- Update the
Resources/config.jsonfile with your API keys:{ "TelegramBotToken": "your_telegram_bot_token_here", "OpenAiApiKey": "your_openai_api_key_here" }
The bot includes the following resource files:
Resources/config.json- Configuration settingsResources/SmartSet.txt- Smart quotations datasetResources/QuotationBook.txt- Collection of "funny" quotationsAiLogs.txt- AI interaction logs (auto-generated)
- Clone the repository
- Navigate to the solution directory
- Update the configuration file with your API keys
- Build and run the application:
dotnet restore dotnet build dotnet run --project TgBot
- OpenAI-powered responses
- Quote management system
- Logging of AI interactions
- Dependency injection architecture
The solution uses:
- C# 10 language features
- Nullable reference types enabled
- .NET 6.0 target framework
- Microsoft Extensions for hosting and DI
This project is to be used for educational purposes only.