birthdaybot/README.md
Miguel de la Cruz 8087e91d69 Fix readme typo
2023-07-11 11:30:29 +02:00

77 lines
2.6 KiB
Markdown

[![pipeline status](https://gitlab.ctrlz.es/mgdelacroix/birthdaybot/badges/main/pipeline.svg)](https://gitlab.ctrlz.es/mgdelacroix/birthdaybot/-/commits/main)
# Birthday bot
A simple bot that notifies of birthdays, posting the contact
information of the subject so you can reach them easily.
## Configuration
There is an [example configuration file](./example-config.yml) that
can be used as a base to create your own configuration, and there is a
[birthdays example CSV file](./birthdays.csv) to load the data.
### Template file
The template can be configured using the `birthday_template` config
parameter to point to the template file. The template uses the Go
Template Format, and has the following properties available:
- `.Name`: the name of the person whose birthday we're notifying.
- `.Email`: the email of the person.
- `.Phone`: the phone of the person, as a string.
- `.YearOfBirth`: the year that the person was born, as number.
- `.MonthOfBirth`: the month that the person was born, as number.
- `.DayOfBirth`: the day that the person was born, as number.
There are as well some functions available to be used:
- `getYearsOld`: receives the year that a user was born, and returns
how old the user is getting.
### Pictures
Alongside the notification for each birthday, the bot can send a
picture for the person with the notification message. For this to
happen, you need to put the pictures in a folder, and point the
configuration to this folder using the property `birthdays.pictures`.
Each file should be named accordingly of the birthday it corresponds
to. The naming schema is `YEAR_MONTH_DAY_PHONE.png`, so for a person
born the 1st of July of 2020, with the phone 4567, the file name for
their picture would be `2020_6_1_4567.png`
## Run the bot
To get help for the bot command, run:
```sh
$ ./birthdaybot -help
Usage of ./birthdaybot:
-config string
path to the configuration file (default "birthdaybot.yml")
```
To run the server with the development defaults, run:
```sh
$ make run
```
## Roadmap
- [X] Create the bot scaffold
- [X] Define how to read the birthdays info
- [X] Add a logger instance to the config
- [X] Add config validation on server creation
- [X] Add options to the server
- [X] Pass logger to the server through an option
- [X] Configure logger through config (levels and such)
- [X] Reduce logger verbosity (through levels)
- [X] Add pictures to birthday notifications
- [X] Create a configurable template to fill with each notification
- [ ] Create different message systems to use with the bot
- [X] Telegram
- [ ] Email
- [ ] Mattermost
- [ ] Enjoy!