完善发送文件接口
This commit is contained in:
parent
2b313fe3d8
commit
17eeea93a9
1
2.json
Executable file
1
2.json
Executable file
@ -0,0 +1 @@
|
|||||||
|
{"Cookie":{"https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?_=1619753139\u0026loginicon=true\u0026r=1025809\u0026tip=0\u0026uuid=gYZs5buMyQ%3D%3D":[],"https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?_=1619753149\u0026loginicon=true\u0026r=1025809\u0026tip=0\u0026uuid=gYZs5buMyQ%3D%3D":[],"https://login.wx.qq.com/jslogin?_=1619753139\u0026appid=wx782c26e4c19acffb\u0026fun=new\u0026lang=zh_CN\u0026redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage%3Fmod%3Ddesktop":[],"https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=ARAycLZsFpdoTlhU3tN5XVLN@qrticket_0\u0026uuid=gYZs5buMyQ==\u0026lang=zh_CN\u0026scan=1619753075":[{"Name":"wxuin","Value":"1708795586","Path":"/","Domain":"wx.qq.com","Expires":"2021-04-30T15:24:37Z","RawExpires":"Fri, 30-Apr-2021 15:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"wxuin=1708795586; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Apr-2021 15:24:37 GMT; Secure","Unparsed":null},{"Name":"wxsid","Value":"VZXeFoWYP7GCaAIq","Path":"/","Domain":"wx.qq.com","Expires":"2021-04-30T15:24:37Z","RawExpires":"Fri, 30-Apr-2021 15:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"wxsid=VZXeFoWYP7GCaAIq; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Apr-2021 15:24:37 GMT; Secure","Unparsed":null},{"Name":"wxloadtime","Value":"1619753077","Path":"/","Domain":"wx.qq.com","Expires":"2021-04-30T15:24:37Z","RawExpires":"Fri, 30-Apr-2021 15:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"wxloadtime=1619753077; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Apr-2021 15:24:37 GMT; Secure","Unparsed":null},{"Name":"mm_lang","Value":"zh_CN","Path":"/","Domain":"wx.qq.com","Expires":"2021-04-30T15:24:37Z","RawExpires":"Fri, 30-Apr-2021 15:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"mm_lang=zh_CN; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Apr-2021 15:24:37 GMT; Secure","Unparsed":null},{"Name":"webwx_data_ticket","Value":"gSfhlzZhJxwsKqOCSn0LU+PF","Path":"/","Domain":".qq.com","Expires":"2021-04-30T15:24:37Z","RawExpires":"Fri, 30-Apr-2021 15:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"webwx_data_ticket=gSfhlzZhJxwsKqOCSn0LU+PF; Domain=.qq.com; Path=/; Expires=Fri, 30-Apr-2021 15:24:37 GMT; Secure","Unparsed":null},{"Name":"webwxuvid","Value":"e17d2b8599a5bfaff2286973a25242e25f0eb06badd866a87869372f4d33f13b2615dae18ba2e5757d246fba3023f0b4","Path":"/","Domain":"wx.qq.com","Expires":"2031-04-28T03:24:37Z","RawExpires":"Mon, 28-Apr-2031 03:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"webwxuvid=e17d2b8599a5bfaff2286973a25242e25f0eb06badd866a87869372f4d33f13b2615dae18ba2e5757d246fba3023f0b4; Domain=wx.qq.com; Path=/; Expires=Mon, 28-Apr-2031 03:24:37 GMT; Secure","Unparsed":null},{"Name":"webwx_auth_ticket","Value":"CIsBELDQxc8MGoABhFi8lbeoxYn56VO3NskD7ei0hTFQ7yVTBm1VuwCE5mTQF0cRl3LOrIe3S7E5N0z1l7TITU1DUnirItDTYKppbK7PlSGspP2384nK48mQOVw7HQuP+/fFq3scSXqxCs0bQtDmJrZXulySMAudgNvN11KWu589QaYKarR9KuwmEAk=","Path":"/","Domain":"wx.qq.com","Expires":"2031-04-28T03:24:37Z","RawExpires":"Mon, 28-Apr-2031 03:24:37 GMT","MaxAge":0,"Secure":true,"HttpOnly":false,"SameSite":0,"Raw":"webwx_auth_ticket=CIsBELDQxc8MGoABhFi8lbeoxYn56VO3NskD7ei0hTFQ7yVTBm1VuwCE5mTQF0cRl3LOrIe3S7E5N0z1l7TITU1DUnirItDTYKppbK7PlSGspP2384nK48mQOVw7HQuP+/fFq3scSXqxCs0bQtDmJrZXulySMAudgNvN11KWu589QaYKarR9KuwmEAk=; Domain=wx.qq.com; Path=/; Expires=Mon, 28-Apr-2031 03:24:37 GMT; Secure","Unparsed":null}]},"Req":{"Uin":1708795586,"Sid":"VZXeFoWYP7GCaAIq","Skey":"@crypt_b8947f4b_bca6295f7539ee2d5656703e1136ce2b","DeviceID":"e624831403780183"},"Info":{"Ret":0,"WxUin":1708795586,"IsGrayScale":1,"Message":"","SKey":"@crypt_b8947f4b_bca6295f7539ee2d5656703e1136ce2b","WxSid":"VZXeFoWYP7GCaAIq","PassTicket":"7oehPxVcZlQmxgWmYmVU0YTBh3uz97QtXc3Ia9rhx%2Bpa%2B5VV4%2BdWMrX8glP4m5qN"}}
|
@ -308,9 +308,9 @@ func TestSendFile(t *testing.T) {
|
|||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, _ := os.Open("Taylor+Swift+-+Red")
|
f, _ := os.Open("README.md")
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
msg, err := self.SendFileToFriend(fh, f)
|
msg, err := fh.SendFile(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
|
10
relations.go
10
relations.go
@ -33,6 +33,11 @@ func (f *Friend) SendImage(file *os.File) (*SentMessage, error) {
|
|||||||
return f.Self.SendImageToFriend(f, file)
|
return f.Self.SendImageToFriend(f, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送文件消息
|
||||||
|
func (f *Friend) SendFile(file *os.File) (*SentMessage, error) {
|
||||||
|
return f.Self.SendFileToFriend(f, file)
|
||||||
|
}
|
||||||
|
|
||||||
// 拉该好友入群
|
// 拉该好友入群
|
||||||
func (f *Friend) AddIntoGroup(groups ...*Group) error {
|
func (f *Friend) AddIntoGroup(groups ...*Group) error {
|
||||||
return f.Self.AddFriendIntoManyGroups(f, groups...)
|
return f.Self.AddFriendIntoManyGroups(f, groups...)
|
||||||
@ -159,6 +164,11 @@ func (g *Group) SendImage(file *os.File) (*SentMessage, error) {
|
|||||||
return g.Self.SendImageToGroup(g, file)
|
return g.Self.SendImageToGroup(g, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送文件给当前的群组
|
||||||
|
func (g *Group) SendFile(file *os.File) (*SentMessage, error) {
|
||||||
|
return g.Self.SendFileToGroup(g, file)
|
||||||
|
}
|
||||||
|
|
||||||
// 获取所有的群成员
|
// 获取所有的群成员
|
||||||
func (g *Group) Members() (Members, error) {
|
func (g *Group) Members() (Members, error) {
|
||||||
group, err := g.Detail()
|
group, err := g.Detail()
|
||||||
|
8
user.go
8
user.go
@ -242,6 +242,7 @@ func (s *Self) SendImageToFriend(friend *Friend, file *os.File) (*SentMessage, e
|
|||||||
return s.Bot.Caller.WebWxSendImageMsg(file, req, info, s.UserName, friend.UserName)
|
return s.Bot.Caller.WebWxSendImageMsg(file, req, info, s.UserName, friend.UserName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送文件给好友
|
||||||
func (s *Self) SendFileToFriend(friend *Friend, file *os.File) (*SentMessage, error) {
|
func (s *Self) SendFileToFriend(friend *Friend, file *os.File) (*SentMessage, error) {
|
||||||
req := s.Bot.storage.Request
|
req := s.Bot.storage.Request
|
||||||
info := s.Bot.storage.LoginInfo
|
info := s.Bot.storage.LoginInfo
|
||||||
@ -339,6 +340,13 @@ func (s *Self) SendImageToGroup(group *Group, file *os.File) (*SentMessage, erro
|
|||||||
return s.Bot.Caller.WebWxSendImageMsg(file, req, info, s.UserName, group.UserName)
|
return s.Bot.Caller.WebWxSendImageMsg(file, req, info, s.UserName, group.UserName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送文件给群组
|
||||||
|
func (s *Self) SendFileToGroup(group *Group, file *os.File) (*SentMessage, error) {
|
||||||
|
req := s.Bot.storage.Request
|
||||||
|
info := s.Bot.storage.LoginInfo
|
||||||
|
return s.Bot.Caller.WebWxSendFile(file, req, info, s.UserName, group.UserName)
|
||||||
|
}
|
||||||
|
|
||||||
// 撤回消息
|
// 撤回消息
|
||||||
// sentMessage, err := friend.SendText("message")
|
// sentMessage, err := friend.SendText("message")
|
||||||
// if err == nil {
|
// if err == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user