Rename handshake function
This commit is contained in:
parent
34cb69d101
commit
d65ec3bd58
26
main.go
26
main.go
|
@ -157,7 +157,7 @@ func ReceiveMessage(ws *websocket.Conn, data []byte) {
|
|||
_ = json.Unmarshal(raw, &msg)
|
||||
ReceiveChatMessage(ws, &msg)
|
||||
case "b":
|
||||
ReceiveBMessage(ws)
|
||||
SendHandshake(ws)
|
||||
default:
|
||||
return
|
||||
}
|
||||
|
@ -175,18 +175,6 @@ func ReceiveNqMessage(msg *mpp.NoteQuotaMppMessage) {
|
|||
// println(msg.MaxHistLen)
|
||||
}
|
||||
|
||||
func ReceiveBMessage(ws *websocket.Conn) {
|
||||
// histr := "[{\"m\":\"hi\"},{\"m\":\"ch\",\"_id\":\"✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧\"}]"
|
||||
histr := "[{\"m\":\"hi\",\"token\":\"" + token + "\"}]"
|
||||
// println("Sending hi message: " + histr)
|
||||
err := ws.WriteMessage(1, []byte(histr))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
SendTimeMessage(ws)
|
||||
// sentHi = true
|
||||
}
|
||||
|
||||
func ReceiveHiMessage(ws *websocket.Conn, msg *mpp.HiMppMessage) {
|
||||
println("I am " + msg.User.Name)
|
||||
|
||||
|
@ -198,6 +186,18 @@ func ReceiveHiMessage(ws *websocket.Conn, msg *mpp.HiMppMessage) {
|
|||
}
|
||||
}
|
||||
|
||||
func SendHandshake(ws *websocket.Conn) {
|
||||
// histr := "[{\"m\":\"hi\"},{\"m\":\"ch\",\"_id\":\"✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧\"}]"
|
||||
histr := "[{\"m\":\"hi\",\"token\":\"" + token + "\"}]"
|
||||
// println("Sending hi message: " + histr)
|
||||
err := ws.WriteMessage(1, []byte(histr))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
SendTimeMessage(ws)
|
||||
// sentHi = true
|
||||
}
|
||||
|
||||
type CommandData struct {
|
||||
mpp.ChatMppMessage
|
||||
Args []string
|
||||
|
|
Loading…
Reference in New Issue