-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaller.go
47 lines (38 loc) · 1.05 KB
/
caller.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
package caller_elling
import (
"github.com/Elytrium/caller-elling/methods"
"github.com/Elytrium/caller-elling/types"
"github.com/Elytrium/elling/basic/common"
"github.com/Elytrium/elling/elling"
"github.com/Elytrium/elling/module"
"github.com/Elytrium/elling/routing"
"github.com/rs/zerolog/log"
"reflect"
)
type Caller struct{}
type UserListener struct {}
type MasterListener struct {}
func (*Caller) OnModuleInit() {
types.Instructions = common.ReadInstructions("caller", reflect.TypeOf(types.Method{}))
types.LoadConfig()
elling.RegisterListener(UserListener{})
}
func (*Caller) OnModuleRemove() {}
func (*Caller) GetMeta() *module.Meta {
return &module.Meta{
Name: "caller",
Routes: map[string]routing.Method{
"call": &methods.Call{},
"verify": &methods.Verify{},
"get": &methods.Get{},
},
DatabaseFields: []interface{}{},
}
}
func (*UserListener) OnUserCreation(e elling.UserCreationEvent) {
err := e.User.Deactivate()
if err != nil {
log.Error().Err(err).Msg("Deactivating before phone verification")
}
}
var Module Caller