-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion.go
54 lines (45 loc) · 868 Bytes
/
question.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
package main
import (
"encoding/gob"
"github.com/albrow/zoom"
tele "gopkg.in/telebot.v3"
)
type Question struct {
zoom.RandomID
StudentID string
TAID string
Context string
Messages []any
Answers []any
}
var (
Questions *zoom.Collection
)
func newQuestion() *Question {
return &Question{
StudentID: "",
TAID: "",
Messages: []any{},
Answers: []any{},
}
}
func CreateQuestions() {
gob.Register(tele.Message{})
_Questions, err := pool.NewCollectionWithOptions(&Question{},
zoom.DefaultCollectionOptions.WithIndex(true))
if err != nil {
// handle error
panic(err)
}
Questions = _Questions
}
func (q *Question) GetStudent() *Student {
return GetStudent(q.StudentID)
}
func (q *Question) GetTA() *TA {
return GetTA(q.TAID)
}
//
//func (q *Question) GetCategory() *Category {
// return GetCategory(q.CategoryID)
//}