1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-05 18:50:24 +08:00

finish base

This commit is contained in:
源文雨
2023-10-10 14:10:13 +09:00
parent 6c87546b44
commit 3dbb8d7b34
13 changed files with 427 additions and 0 deletions

31
openapi_user.go Normal file
View File

@@ -0,0 +1,31 @@
package nano
// User 用户对象
//
// https://bot.q.qq.com/wiki/develop/api/openapi/user/model.html
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Avatar string `json:"avatar"`
Bot bool `json:"bot"`
UnionOpenid string `json:"union_openid"`
UnionUserAccount string `json:"union_user_account"`
}
// GetMe 获取当前用户(机器人)详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/user/me.html
func (bot *Bot) GetMe() (*User, error) {
return bot.getOpenAPIofUser("/users/@me")
}
// GetMyGuilds 获取当前用户(机器人)频道列表,支持分页
//
// https://bot.q.qq.com/wiki/develop/api/openapi/user/guilds.html
func (bot *Bot) GetMyGuilds(before, after string, limit int) (*GuildArray, error) {
return bot.getOpenAPIofGuildArray(WriteHTTPQueryIfNotNil("/users/@me/guilds",
"before", before,
"after", after,
"limit", limit,
))
}