Rename handshake function

This commit is contained in:
Hri7566 2024-04-20 15:41:10 -04:00
parent 34cb69d101
commit d65ec3bd58
1 changed files with 13 additions and 13 deletions

26
main.go
View File

@ -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