Skip to content

Telegram Daily Bot: A Java Spring Boot application for managing tasks, notifications, and users in Telegram groups with ChatGPT3 integration.

License

Notifications You must be signed in to change notification settings

GreyKa68/TelegramDailyBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Daily Bot

Table of Contents

Introduction

This is a backend application for a Telegram bot built with Spring Boot. The bot helps manage daily tasks and notifications for groups, allowing users to add, delete, and edit users, notifications, and chats. It also features interaction with ChatGPT3 for quick Q&A sessions.

Features

  • User Management:
    • Add, delete, and edit users
  • Notification Management:
    • Add, delete, and edit notifications
    • Send time-based notifications
    • Show list of notifications
  • Chat Management:
    • Add, delete, and edit chats
    • Show list of users
    • Assign winners for daily tasks
    • Reset winners
  • ChatGPT3 Interaction:
    • Interact with ChatGPT3

Prerequisites

  • Java 17
  • Spring Boot 3.0.5
  • Maven 3.x
  • PostgreSQL 13.x

Getting Started

Follow these steps to set up and run the Telegram Daily Bot:

Step 1: Clone the repository

Clone this repository to your local machine:

git clone https://github.com/yourusername/telegramdailybot.git

Step 2: Create a PostgreSQL database

Create a PostgreSQL database using src/main/resources/db/schema.sql.

Step 3: Adjust the configuration

Set your:

  • Telegram bot usename and token
  • Connection to the database
  • (optionally) GPT-3 API key

Rename src/main/resources/application.properties.example into application.properties and adjust the following properties:

telegrambot.botUsername=YOUR_TELEGRAM_BOT_USERNAME
telegrambot.botToken:=YOUR_TELEGRAM_BOT_TOKEN
telegrambot.timezone=YOUR_TIMEZONE
spring.datasource.url=jdbc:postgresql://localhost:5432/YOUR_DATABASE_NAME
spring.datasource.username=YOUR_DATABASE_USERNAME
spring.datasource.password=YOUR_DATABASE_PASSWORD
openai.token=YOUR_GPT3_API_KEY

When setting your timezone, use the IANA timezone format, for example Europe/Berlin. application.properties should be kept in the same folder as the jar file.

Step 4: Build the project

Change your current working directory to the telegramdailybot folder:

cd telegramdailybot

Use Maven to build the project:

mvn clean install

Step 5: Run the application

After the build is successful, run the Spring Boot application:

mvn spring-boot:run

Now the Telegram Daily Bot is up and running. You can start interacting with the bot by sending commands and messages.

Step 6: Add first admin user

Get you Telegram user ID by sending /getchatid command to the bot.

Add first admin user manually in the database. You can do this by running the following SQL query:

INSERT INTO public.chats(name, telegramchatid, role)
VALUES ('<YourName>', <your telegram user id>, 'admin');

Usage

  • /start: Initialize the bot
  • /getchatid: Get the chat ID
  • /next: Select the next winner
  • /resetwinners: Reset the winners list
  • /showusers: Show the list of users
  • /shownotifications: Show the list of notifications
  • /editusers: Edit users
  • /editnotifications: Edit notifications
  • /editchats: Edit group chats - this command is only available to admin users
  • /askchatgpt3: Ask a question to ChatGPT3

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Telegram Daily Bot: A Java Spring Boot application for managing tasks, notifications, and users in Telegram groups with ChatGPT3 integration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages