Skip to content

Commit

Permalink
feat: set qq profile (#1389)
Browse files Browse the repository at this point in the history
* feat: set qq profile

* refactor: support empty field
  • Loading branch information
qianjunakasumi committed Feb 22, 2022
1 parent c7f0aed commit d1f143e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions coolq/api.go
Expand Up @@ -1981,6 +1981,27 @@ func (bot *CQBot) CQMarkMessageAsRead(msgID int32) global.MSG {
return OK(nil)
}

// CQSetQQProfile 设置 QQ 资料
//
// @route(set_qq_profile)
func (bot *CQBot) CQSetQQProfile(nickname, company, email, college, personalNote gjson.Result) global.MSG {
u := client.NewProfileDetailUpdate()

fi := func(f gjson.Result, do func(value string) client.ProfileDetailUpdate) {
if f.Exists() {
do(f.String())
}
}

fi(nickname, u.Nick)
fi(company, u.Company)
fi(email, u.Email)
fi(college, u.College)
fi(personalNote, u.PersonalNote)
bot.Client.UpdateProfile(u)
return OK(nil)
}

// CQReloadEventFilter 重载事件过滤器
//
// @route(reload_event_filter)
Expand Down
7 changes: 7 additions & 0 deletions modules/api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d1f143e

Please sign in to comment.