file.go 748 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package api
  2. import (
  3. "fmt"
  4. "github.com/gorilla/websocket"
  5. )
  6. func (conn *WsBot) Upload_group_file(group_id int, file string, name string, folder string) error {
  7. err := conn.Wsconn.WriteMessage(websocket.TextMessage,
  8. []byte(fmt.Sprintf(`
  9. {
  10. "action":"upload_group_file",
  11. "params":{
  12. "group_id":%d,
  13. "file":"%s",
  14. "name":"%s",
  15. "folder":"%s"
  16. }
  17. }
  18. `, group_id, file, name, folder)))
  19. return err
  20. }
  21. func (conn *WsBot) Upload_private_file(user_id int, file string, name string) error {
  22. err := conn.Wsconn.WriteMessage(websocket.TextMessage,
  23. []byte(fmt.Sprintf(`
  24. {
  25. "action":"upload_private_file",
  26. "params":{
  27. "user_id":%d,
  28. "file":"%s",
  29. "name":"%s",
  30. }
  31. }
  32. `, user_id, file, name)))
  33. return err
  34. }