This commit is contained in:
shoopea 2019-05-09 10:27:21 +08:00
parent 8d136bd051
commit ec2f4be604

35
def.go
View File

@ -61,6 +61,41 @@ const (
SQLJobWorkers = 3
)
var (
chatWarsMonth = map[string]int{
"Wintar": 1,
"Hornung": 2,
"Lenzin": 3,
"Ōstar": 4,
"Winni": 5,
"Brāh": 6,
"Hewi": 7,
"Aran": 8,
"Witu": 9,
"Wīndume": 10,
"Herbist": 11,
"Hailag": 12}
chatWarsDaysSpecial = map[int]map[int]int{
2:{1060:29},
4:{1060:29}
}
chatWarsDays = map[int]int{
1: 31,
2: 28,
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
11: 30,
12: 31}
)
func fromChatWarsDate(d string) (t time.Time, err error) {
r := regexp.MustCompile(`(?P<Day>[0-9]{2}) (?P<Month>(Wintar|Hornung|Lenzin|Ōstar|Winni|Brāh|Hewi|Aran|Witu|Wīndume|Herbist|Hailag)) (?P<Year>[0-9]{4})( (?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})){0,1}`)
if r.FindStringSubmatch(d) != nil {