-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconstants.go
49 lines (40 loc) · 1.08 KB
/
constants.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
package main
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
tb "gopkg.in/tucnak/telebot.v2"
)
// Unique identifiers for various inline callbacks
const (
// Cancel all reminders for user
CallbackCancelAll = "cancel_all_reminders"
// Selected reminder to cancel
CallbackCancelReminder = "cancel_reminder"
// To abort the /cancel command
CallbackAbortCancel = "abort_cancel"
)
// Reminder represents a unit of time to wait
type Reminder struct {
units string
quantity int
duration time.Duration
timestamp int64
}
// StoredReminder stores a message
type StoredReminder struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
ChatID int64 `bson:"chat_id"`
MessageID int `bson:"message_id"`
User *tb.User `bson:"user"`
Timestamp int64 `bson:"timestamp"`
}
var timeUnits = []string{"second", "minute", "hour", "day", "week", "month"}
// Maps unit names to seconds
var unitMap = map[string]int{
"second": 1,
"minute": 60,
"hour": 3600,
"day": 86400,
"week": 604800,
"month": 2419200000,
}