forked from jheuel/pollrBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
55 lines (45 loc) · 945 Bytes
/
types.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
package main
import (
"fmt"
)
type answer struct {
ID int
PollID int
UserID int64
OptionID int
LastSaved int64
}
type option struct {
ID int
PollID int
Text string
}
type poll struct {
ID int
MessageID int
UserID int64
Question string
Inactive int
Type int
DisplayPercent int
Options []option
Answers []answer
}
func (poll *poll) fmtQuery(query string) string {
return fmt.Sprintf("%c:%d:%s", qryEditPayload, poll.ID, query)
}
func (poll *poll) isInactive() bool {
return poll.Inactive == inactive
}
func (poll *poll) isSingleChoice() bool {
return poll.Type == standard
}
func (poll *poll) isMultipleChoice() bool {
return poll.Type == multipleChoice
}
func (poll *poll) isRankedVoting() bool {
return poll.Type == rankedVoting
}
func (poll *poll) isDisplayVotePercent() bool {
return poll.DisplayPercent == displayVotePercent
}