mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
parent
a57a44f3d6
commit
144220a1da
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
vendor/
|
||||
.idea
|
||||
.vscode
|
||||
config.hjson
|
||||
device.json
|
||||
codec/
|
||||
data/
|
||||
logs/
|
@ -55,7 +55,7 @@ linters:
|
||||
- prealloc
|
||||
- predeclared
|
||||
- asciicheck
|
||||
- revive
|
||||
- golint
|
||||
- forbidigo
|
||||
- makezero
|
||||
#- interfacer
|
||||
@ -82,7 +82,7 @@ run:
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
format: 'colored-line-number'
|
||||
format: "colored-line-number"
|
||||
print-issued-lines: true
|
||||
print-linter-name: true
|
||||
uniq-by-line: true
|
||||
@ -90,3 +90,6 @@ output:
|
||||
issues:
|
||||
# Fix found issues (if it's supported by the linter)
|
||||
fix: true
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
- "Error return value of .((os.)?std(out|err)..*|.*Close|.*Flush|os.Remove(All)?|.*print(f|ln)?|os.(Un)?Setenv). is not check"
|
||||
|
@ -1,5 +1,6 @@
|
||||
package global
|
||||
|
||||
// AccountToken 存储AccountToken供登录使用
|
||||
var AccountToken []byte
|
||||
|
||||
// PasswordHash 存储QQ密码哈希供登录使用
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Package config 包含go-cqhttp操作配置文件的相关函数
|
||||
package config
|
||||
|
||||
import (
|
||||
@ -56,6 +57,7 @@ type Config struct {
|
||||
Database map[string]yaml.Node `yaml:"database"`
|
||||
}
|
||||
|
||||
// MiddleWares 通信中间件
|
||||
type MiddleWares struct {
|
||||
AccessToken string `yaml:"access-token"`
|
||||
Filter string `yaml:"filter"`
|
||||
|
2
global/terminal/doc.go
Normal file
2
global/terminal/doc.go
Normal file
@ -0,0 +1,2 @@
|
||||
// Package terminal 包含用于检测在windows下是否通过双击运行go-cqhttp的函数
|
||||
package terminal
|
@ -2,6 +2,7 @@
|
||||
|
||||
package terminal
|
||||
|
||||
// RunningByDoubleClick 检查是否通过双击直接运行,非Windows系统永远返回false
|
||||
func RunningByDoubleClick() bool {
|
||||
return false
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Package update 包含go-cqhttp自我更新相关函数
|
||||
package update
|
||||
|
||||
import (
|
||||
@ -34,8 +35,8 @@ func (wc *WriteCounter) PrintProgress() {
|
||||
fmt.Printf("\rDownloading... %s complete", humanize.Bytes(wc.Total))
|
||||
}
|
||||
|
||||
// UpdateFromStream copy form getlantern/go-update
|
||||
func UpdateFromStream(updateWith io.Reader) (err error, errRecover error) {
|
||||
// FromStream copy form getlantern/go-update
|
||||
func FromStream(updateWith io.Reader) (err error, errRecover error) {
|
||||
updatePath, err := osext.Executable()
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Update go-cqhttp自我更新
|
||||
func Update(url string) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
@ -38,7 +39,7 @@ func Update(url string) {
|
||||
return
|
||||
}
|
||||
if header.Name == "go-cqhttp" {
|
||||
err, _ := UpdateFromStream(tr)
|
||||
err, _ := FromStream(tr)
|
||||
fmt.Println()
|
||||
if err != nil {
|
||||
log.Error("更新失败!", err)
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Update go-cqhttp自我更新
|
||||
func Update(url string) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
@ -25,7 +26,7 @@ func Update(url string) {
|
||||
log.Error("更新失败!", err)
|
||||
return
|
||||
}
|
||||
err, _ = UpdateFromStream(file)
|
||||
err, _ = FromStream(file)
|
||||
fmt.Println()
|
||||
if err != nil {
|
||||
log.Error("更新失败!", err)
|
||||
|
@ -322,6 +322,7 @@ func handleQuickOperation(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
return bot.CQHandleQuickOperation(p.Get("context"), p.Get("operation"))
|
||||
}
|
||||
|
||||
// API 是go-cqhttp当前支持的所有api的映射表
|
||||
var API = map[string]func(*coolq.CQBot, resultGetter) coolq.MSG{
|
||||
"get_login_info": getLoginInfo,
|
||||
"get_friend_list": getFriendList,
|
||||
|
@ -43,6 +43,7 @@ type httpContext struct {
|
||||
ctx *gin.Context
|
||||
}
|
||||
|
||||
// RunHTTPServerAndClients 启动HTTP服务器与HTTP上报客户端
|
||||
func RunHTTPServerAndClients(bot *coolq.CQBot, conf *config.HTTPServer) {
|
||||
if conf.Disabled {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user