File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,10 @@ func main() {
28
28
logrus .Fatal (err )
29
29
}
30
30
31
- id := string (msg )
32
-
33
31
client := jsonrpc .NewClient (ws .UnderlyingConn ())
34
32
defer client .Close ()
35
33
34
+ id := string (msg )
36
35
go getUnreadMessages (id , client )
37
36
38
37
fmt .Println (
@@ -56,7 +55,7 @@ func main() {
56
55
fmt .Println ("Ваш id:" , id )
57
56
default :
58
57
sending := strings .Split (text , " %$4^b " )
59
- if len (sending ) == 0 {
58
+ if len (sending ) == 0 || len ( sending ) > 2 {
60
59
logrus .Error ("Неккоректный формат входных данных" )
61
60
continue
62
61
}
@@ -75,7 +74,9 @@ func getUnreadMessages(id string, client *rpc.Client) {
75
74
var result * []string
76
75
if err := client .Call ("Handler.GetMessages" , args , & result ); err != nil {
77
76
logrus .Fatal (err )
78
- } else if len (* result ) != 0 {
77
+ }
78
+
79
+ if len (* result ) != 0 {
79
80
for _ , msg := range * result {
80
81
logrus .Println (msg )
81
82
}
You can’t perform that action at this time.
0 commit comments