This is a Telegram bot built using Go that allows users to upload word pairs and receive reminders with those pairs.
- Upload word pairs in the format
word1,word2
. - Clear uploaded word pairs.
- Set the number of pairs to send in reminders.
- Set the frequency of reminders per day.
- Periodic reminders sent to users with random word pairs.
- Go 1.23 or newer
- PostgreSQL database
- A Telegram bot token (create one using BotFather)
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
go mod tidy
-
Create a configuration file: Create a
config.json
file in the root directory of the project with the following structure:{ "database": { "host": "your-database-host", "user": "your-database-user", "password": "your-database-password", "dbname": "your-database-name", "port": "your-database-port", "sslmode": "require" }, "telegram": { "token": "your-telegram-bot-token" } }
-
Run the bot:
go build ./cmd/tg-word-reminder ./tg-word-reminder
You can send a CSV file with word pairs to the bot to upload them. Please refer to the example file example.csv
for the correct format.
- Commands:
/getpair
: Get a random word pair./clear
: Clear all uploaded word pairs./setnum <number>
: Set the number of pairs to send in reminders./setfreq <number>
: Set the frequency of reminders per day.
The bot uses a PostgreSQL database. Ensure that the database is set up and accessible based on the configuration provided in config.json
. The bot will automatically create the necessary tables for storing word pairs and user settings.
The bot uses the standard library's slog
package for logging. Logs will be printed to the console.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.