{"id":17247124,"url":"https://github.com/kevingong2013/wechat","last_synced_at":"2025-06-14T01:33:35.040Z","repository":{"id":57482782,"uuid":"83522574","full_name":"KevinGong2013/wechat","owner":"KevinGong2013","description":"web wechat api by golang","archived":false,"fork":false,"pushed_at":"2020-03-24T01:55:47.000Z","size":2138,"stargazers_count":86,"open_issues_count":3,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-03T19:14:57.349Z","etag":null,"topics":["golang","wechat"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevinGong2013.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-01T06:55:33.000Z","updated_at":"2024-06-26T02:44:30.000Z","dependencies_parsed_at":"2022-09-26T17:50:36.407Z","dependency_job_id":null,"html_url":"https://github.com/KevinGong2013/wechat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KevinGong2013/wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGong2013%2Fwechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGong2013%2Fwechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGong2013%2Fwechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGong2013%2Fwechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinGong2013","download_url":"https://codeload.github.com/KevinGong2013/wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGong2013%2Fwechat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259745364,"owners_count":22905082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","wechat"],"created_at":"2024-10-15T06:36:26.763Z","updated_at":"2025-06-14T01:33:34.987Z","avatar_url":"https://github.com/KevinGong2013.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wechat\nAwaken your wechat bot.\n\n## INSTALLATION\n```go\ngo get github.com/KevinGong2013/ggbot/wechat\n```\n\n## Basic Usage\n\n```go\nimport \"github.com/KevinGong2013/wechat\"\n\n// awaken a bot\nbot, _ := wechat.AwakenNewBot(nil)\nbot.Go() // begin handle everything\n```\n\n## Login State\n```go\nbot.Handle(`/login`, func(arg2 wechat.Event) {\n\tisSuccess := arg2.Data.(int) == 1\n\tif isSuccess {\n\t\tfmt.Println(`login Success`)\n\t} else {\n\t\tfmt.Println(`login Failed`)\n\t}\n})\n```\n\n## Contact\n### Get\n``` go\n// all contacts\n\nbot.AllContacts()\n\n// get contact by `UserName`\ncontact, _ := bot.ContactByUserName(UserName)\n\n// get contact by `NickName`\ncontacts, _ := bot.ContactsByNickName(NickName)\n```\n### Change\n```go\n// handle contact change event\nbot.Handle(`/contact`, func(evt wechat.Event) {\n\tdata := evt.Data.(wechat.EventContactData)\n\tfmt.Println(`contact change event` + data.GGID)\n})\n```\n\n## Message\n### Send\n```go\nto := `filehelper`\n// text message\nbot.SendTextMsg(`Text`, to)\n// video message\nbot.SendFile(`testResource/test.mov`, to)\n// image message\nbot.SendFile(`testResource/test.png`, to)\n// emoticon message\nbot.SendFile(`testResource/test.gif`, to)\n// file message\nbot.SendFile(`testResource/test.txt`, to)\nbot.SendFile(`testResource/test.mp3`, to)\n```\n### Receive\n```go\n// all solo msg\nbot.Handle(`/msg/solo`, func(evt wechat.Event) {\n\tdata := evt.Data.(wechat.EventMsgData)\n\tfmt.Println(`/msg/solo/` + data.Content)\n})\n\n// all group msg\nbot.Handle(`/msg/group`, func(evt wechat.Event) {\n\tdata := evt.Data.(wechat.EventMsgData)\n\tfmt.Println(`/msg/group/` + data.Content)\n})\n```\n\n## Convenice\n```go\nbot.AddTimer(5 * time.Second)\nbot.Handle(`/timer/5s`, func(arg2 wechat.Event) {\n\tdata := arg2.Data.(wechat.EventTimerData)\n\tif bot.IsLogin {\n\t\tbot.SendTextMsg(fmt.Sprintf(`%v times`, data.Count), `filehelper`)\n\t}\n})\n\nbot.AddTiming(`9:00`)\nbot.Handle(`/timing/9:00`, func(arg2 wechat.Event) {\n\t// data := arg2.Data.(wechat.EventTimingtData)\n\tbot.SendTextMsg(`9:00`, `filehelper`)\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingong2013%2Fwechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevingong2013%2Fwechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingong2013%2Fwechat/lists"}