mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 11:33:48 +08:00
feat: custom online status.
This commit is contained in:
parent
08fd86493d
commit
af46324dd9
@ -25,6 +25,7 @@ type Config struct {
|
||||
Uin int64 `yaml:"uin"`
|
||||
Password string `yaml:"password"`
|
||||
Encrypt bool `yaml:"encrypt"`
|
||||
Status int32 `yaml:"status"`
|
||||
ReLogin struct {
|
||||
Disabled bool `yaml:"disabled"`
|
||||
Delay int `yaml:"delay"`
|
||||
|
@ -4,7 +4,8 @@ account: # 账号相关
|
||||
uin: 1233456 # QQ账号
|
||||
password: '' # 密码为空时使用扫码登录
|
||||
encrypt: false # 是否开启密码加密
|
||||
relogin: # 重连设置
|
||||
status: 0 # 在线状态 0->在线 2->离开 3->隐身 4->忙
|
||||
relogin: # 重连设置
|
||||
disabled: false
|
||||
delay: 3 # 重连延迟, 单位秒
|
||||
interval: 0 # 重连间隔
|
||||
@ -79,10 +80,10 @@ servers:
|
||||
<<: *default # 引用默认中间件
|
||||
# 反向HTTP POST地址列表
|
||||
post:
|
||||
#- url: '' # 地址
|
||||
# secret: '' # 密钥
|
||||
#- url: 127.0.0.1:5701 # 地址
|
||||
# secret: '' # 密钥
|
||||
#- url: '' # 地址
|
||||
# secret: '' # 密钥
|
||||
#- url: 127.0.0.1:5701 # 地址
|
||||
# secret: '' # 密钥
|
||||
|
||||
# 正向WS设置
|
||||
- ws:
|
||||
|
12
main.go
12
main.go
@ -41,6 +41,14 @@ var (
|
||||
c string
|
||||
d bool
|
||||
h bool
|
||||
|
||||
// 允许通过配置文件设置的状态列表
|
||||
allowStatus = [23]client.UserOnlineStatus{client.StatusOnline, client.StatusAway, client.StatusInvisible, client.StatusBusy,
|
||||
client.StatusBattery, client.StatusListening, client.StatusConstellation, client.StatusWeather, client.StatusMeetSpring,
|
||||
client.StatusTimi, client.StatusEatChicken, client.StatusLoving, client.StatusWangWang, client.StatusCookedRice,
|
||||
client.StatusStudy, client.StatusStayUp, client.StatusPlayBall, client.StatusSignal, client.StatusStudyOnline,
|
||||
client.StatusGaming, client.StatusVacationing, client.StatusWatchingTV, client.StatusFitness,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -355,6 +363,10 @@ func main() {
|
||||
log.Infof("开始加载群列表...")
|
||||
global.Check(cli.ReloadGroupList(), true)
|
||||
log.Infof("共加载 %v 个群.", len(cli.GroupList))
|
||||
if conf.Account.Status >= int32(len(allowStatus)) || conf.Account.Status < 0 {
|
||||
conf.Account.Status = 0
|
||||
}
|
||||
cli.SetOnlineStatus(allowStatus[int(conf.Account.Status)])
|
||||
bot := coolq.NewQQBot(cli, conf)
|
||||
_ = bot.Client
|
||||
if conf.Message.PostFormat != "string" && conf.Message.PostFormat != "array" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user