Skip to content

MikhailArtemyev/TelegramChatBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Chat Bot with OpenAI Integration

(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.

Project Structure

  • TgBot - Main Telegram bot application
  • OpenAiInteraction - Library for handling OpenAI API interactions

Prerequisites

  • .NET 6.0 SDK
  • Telegram Bot Token (from @BotFather)
  • OpenAI API Key

Dependencies

  • Microsoft.Extensions.DependencyInjection (8.0.0)
  • Microsoft.Extensions.Hosting (8.0.0)
  • Telegram.Bot (19.0.0)
  • OpenAI (1.10.0)

Configuration

  1. Update the Resources/config.json file with your API keys:
    {
      "TelegramBotToken": "your_telegram_bot_token_here",
      "OpenAiApiKey": "your_openai_api_key_here"
    }

Resources

The bot includes the following resource files:

  • Resources/config.json - Configuration settings
  • Resources/SmartSet.txt - Smart quotations dataset
  • Resources/QuotationBook.txt - Collection of "funny" quotations
  • AiLogs.txt - AI interaction logs (auto-generated)

Getting Started

  1. Clone the repository
  2. Navigate to the solution directory
  3. Update the configuration file with your API keys
  4. Build and run the application:
    dotnet restore
    dotnet build
    dotnet run --project TgBot

Features

  • OpenAI-powered responses
  • Quote management system
  • Logging of AI interactions
  • Dependency injection architecture

Development

The solution uses:

  • C# 10 language features
  • Nullable reference types enabled
  • .NET 6.0 target framework
  • Microsoft Extensions for hosting and DI

License

This project is to be used for educational purposes only.

About

My first Telegram chat bot. Includes funny Russian quote generator and OpenAI ChatGPT interaction (reuploaded June 6 2024)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages