package api import ( "fmt" "github.com/gorilla/websocket" ) func (conn *WsBot) Send_private_msg(user_id int, message string) error { err := conn.Wsconn.WriteMessage(websocket.TextMessage, []byte(fmt.Sprintf(` { "action":"send_private_msg", "params":{ "user_id":%d, "message":"%s" } } `, user_id, message))) return err } func (conn *WsBot) Send_group_msg(group_id int, message string) error { err := conn.Wsconn.WriteMessage(websocket.TextMessage, []byte(fmt.Sprintf(` { "action":"send_group_msg", "params":{ "group_id":%d, "message":"%s" } } `, group_id, message))) return err } func (conn *WsBot) Send_like(user_id int, times int) error { err := conn.Wsconn.WriteMessage(websocket.TextMessage, []byte(fmt.Sprintf(` { "action":"send_like", "params":{ "user_id":%d, "times":"%d" } } `, user_id, times))) return err }