12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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
- }
|