Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb865afb96 |
12
main.go
12
main.go
@@ -35,8 +35,8 @@ type myConfig struct {
|
|||||||
// Входящее сообщение из pubsub-канала redis-ки
|
// Входящее сообщение из pubsub-канала redis-ки
|
||||||
type rMsg struct {
|
type rMsg struct {
|
||||||
From string `json:"from,omitempty"`
|
From string `json:"from,omitempty"`
|
||||||
Chatid int64 `json:"chatid,omitempty"`
|
Chatid string `json:"chatid,omitempty"`
|
||||||
Userid int64 `json:"userid,omitempty"`
|
Userid string `json:"userid,omitempty"`
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
Plugin string `json:"plugin,omitempty"`
|
Plugin string `json:"plugin,omitempty"`
|
||||||
Mode string `json:"mode,omitempty"`
|
Mode string `json:"mode,omitempty"`
|
||||||
@@ -54,8 +54,8 @@ type rMsg struct {
|
|||||||
// Исходящее сообщение в pubsub-канал redis-ки
|
// Исходящее сообщение в pubsub-канал redis-ки
|
||||||
type sMsg struct {
|
type sMsg struct {
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
Chatid int64 `json:"chatid"`
|
Chatid string `json:"chatid"`
|
||||||
Userid int64 `json:"userid"`
|
Userid string `json:"userid"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Plugin string `json:"plugin"`
|
Plugin string `json:"plugin"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
@@ -97,12 +97,12 @@ func msgParser(ctx context.Context, msg string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if exist := j.Chatid; exist == 0 {
|
if exist := j.Chatid; exist == "" {
|
||||||
log.Warnf("Incorrect msg from redis, no chatid field: %s", msg)
|
log.Warnf("Incorrect msg from redis, no chatid field: %s", msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if exist := j.Userid; exist == 0 {
|
if exist := j.Userid; exist == "" {
|
||||||
log.Warnf("Incorrect msg from redis, no userid field: %s", msg)
|
log.Warnf("Incorrect msg from redis, no userid field: %s", msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user