-
Notifications
You must be signed in to change notification settings - Fork 938
/
rsvp.go
57 lines (47 loc) · 1.2 KB
/
rsvp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package rsvp
//go:generate sqlboiler --no-hooks psql
import (
"github.com/jonas747/yagpdb/common"
"github.com/jonas747/yagpdb/timezonecompanion/trules"
"github.com/olebedev/when"
"github.com/olebedev/when/rules"
wcommon "github.com/olebedev/when/rules/common"
"github.com/olebedev/when/rules/en"
"sync"
)
var (
logger = common.GetPluginLogger(&Plugin{})
dateParser *when.Parser
)
func init() {
dateParser = when.New(&rules.Options{
Distance: 10,
MatchByOrder: true})
dateParser.Add(
en.Weekday(rules.Override),
en.CasualDate(rules.Override),
en.CasualTime(rules.Override),
trules.Hour(rules.Override),
trules.HourMinute(rules.Override),
en.Deadline(rules.Override),
en.PastTime(rules.Override),
en.ExactMonthDate(rules.Override),
)
dateParser.Add(wcommon.All...)
}
type Plugin struct {
setupSessions []*SetupSession
setupSessionsMU sync.Mutex
}
func (p *Plugin) PluginInfo() *common.PluginInfo {
return &common.PluginInfo{
Name: "RSVP",
SysName: "rsvp",
Category: common.PluginCategoryMisc,
}
}
func RegisterPlugin() {
p := &Plugin{}
common.InitSchemas("rsvp", DBSchemas...)
common.RegisterPlugin(p)
}