Add simple server creation
This commit is contained in:
parent
c617fe2505
commit
acac38d1f6
2 changed files with 20 additions and 2 deletions
|
@ -9,6 +9,8 @@ information of the subject so you can reach them easily.
|
|||
|
||||
- [ ] Create the bot scaffold
|
||||
- [X] Define how to read the birthdays info
|
||||
- [ ] Add a logger instance to the config
|
||||
- [ ] Add config validation on server creation
|
||||
- [ ] Create a configurable template to fill with each notification
|
||||
- [ ] Create different message systems to use with the bot
|
||||
- [ ] Enjoy!
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.ctrlz.es/mgdelacroix/birthdaybot/model"
|
||||
"git.ctrlz.es/mgdelacroix/birthdaybot/parser"
|
||||
)
|
||||
|
||||
type Server struct{}
|
||||
type Server struct {
|
||||
config *model.Config
|
||||
birthdays []*model.Birthday
|
||||
}
|
||||
|
||||
func New(config *model.Config) (*Server, error) {
|
||||
return nil, nil
|
||||
birthdays, err := parser.ParseCSV(config.BirthdayFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot parse CSV file %s: %w", config.BirthdayFile, err)
|
||||
}
|
||||
|
||||
server := &Server{
|
||||
config: config,
|
||||
birthdays: birthdays,
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue