config

package
v0.0.0-...-1d2b739 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeWebUIURL

func ComposeWebUIURL(useBackupPort bool) string

ComposeWebUIURL 组合webui的完整访问地址 参数 useBackupPort 控制是否使用备用端口

func ComposeWebUIURLv2

func ComposeWebUIURLv2(useBackupPort bool) string

ComposeWebUIURLv2 组合webui的完整访问地址 参数 useBackupPort 控制是否使用备用端口

func DeleteConfig

func DeleteConfig() error

DeleteConfig 删除配置文件并创建一个新的配置文件模板

func ExtractAndTruncateDigits

func ExtractAndTruncateDigits(input string) string

extractAndTruncateDigits 提取字符串中的数字并截取前10位(如果有的话)

func GetAlias

func GetAlias() []string

获取Alias的值

func GetAliyunAccessKeyId

func GetAliyunAccessKeyId() string

GetAliyunAccessKeyId 获取阿里云OSS的AccessKeyId

func GetAliyunAccessKeySecret

func GetAliyunAccessKeySecret() string

GetAliyunAccessKeySecret 获取阿里云OSS的AccessKeySecret

func GetAliyunAudit

func GetAliyunAudit() bool

获取GetAliyunAudit的值

func GetAliyunBucketName

func GetAliyunBucketName() string

GetAliyunBucketName 获取阿里云OSS的AliyunBucketName

func GetAliyunEndpoint

func GetAliyunEndpoint() string

获取阿里云的oss地址 外网的

func GetArrayValue

func GetArrayValue() bool

获取Array的值

func GetBackupPort

func GetBackupPort() string

GetLotusPort retrieves the LotusPort setting from your singleton instance.

func GetBaiduAudit

func GetBaiduAudit() int

获取BaiduAudit

func GetBaiduBCEAK

func GetBaiduBCEAK() string

获取BaiduBCEAK

func GetBaiduBCESK

func GetBaiduBCESK() string

获取BaiduBCESK

func GetBaiduBOSBucketName

func GetBaiduBOSBucketName() string

获取BaiduBOSBucketName

func GetBindPrefix

func GetBindPrefix() string

获取GetBindPrefix的值

func GetBlackPrefixMode

func GetBlackPrefixMode() bool

获取黑名单开启状态

func GetBlackPrefixs

func GetBlackPrefixs() []string

获取黑名单指令数组

func GetBotID

func GetBotID() string

GetBotID 返回当前的botId值。

func GetBotToken

func GetBotToken() string

获取GetBotToken的值

func GetCardAndNick

func GetCardAndNick() string

获取GetCardAndNick的值

func GetCrtPath

func GetCrtPath() string

获取crt路径

func GetCustomBotName

func GetCustomBotName() string

获取GetCustomBotName的值

func GetCustomCert

func GetCustomCert() bool

获取 CustomCert 的值

func GetCustomTemplateID

func GetCustomTemplateID() string

获取 CustomTemplateID 的值

func GetDefaultContent

func GetDefaultContent() []string

获取兜底数组

func GetDefaultDailyReplyLimit

func GetDefaultDailyReplyLimit() int

func GetDeveloperLog

func GetDeveloperLog() bool

开发者日志

func GetEnableWsServer

func GetEnableWsServer() bool

获取port的值

func GetEnters

func GetEnters() []string

获取Enters的值

func GetForwardMsgLimit

func GetForwardMsgLimit() int

获取GetForwardMsgLimit

func GetGlobalGroupOrPrivate

func GetGlobalGroupOrPrivate() bool

获取 GlobalGroupOrPrivate 的值

func GetHashIDValue

func GetHashIDValue() bool

获取HashID

func GetHeartBeatInterval

func GetHeartBeatInterval() int

获取GetHeartBeatInterval的值

func GetHighWay

func GetHighWay() bool

获取 HighWay 的值

func GetHttpAddress

func GetHttpAddress() string

获取 HTTP 地址

func GetHttpGetMsg

func GetHttpGetMsg() bool

获取 httpGetMsg 的值

func GetHttpTimeOut

func GetHttpTimeOut() int

获取 HTTP 超时时间

func GetHttpVersion

func GetHttpVersion() int

获取 HTTP 版本

func GetIdentifyAppids

func GetIdentifyAppids() []int64

获取IdentifyAppids的值

func GetIdentifyFile

func GetIdentifyFile() bool

获取identify_file的值

func GetIdmapPro

func GetIdmapPro() bool

获取GetIdmapPro的值

func GetImageLimit

func GetImageLimit() int

GetImageLimit 返回 ImageLimit 的值

func GetImageLimitB

func GetImageLimitB() int

获取ImageLimitB的值

func GetKeyBoardID

func GetKeyBoardID() string

获取 KeyBoardIDD 的值

func GetKeyPath

func GetKeyPath() string

获取key路径

func GetLaunchReconectTimes

func GetLaunchReconectTimes() int

获取LaunchReconectTimes

func GetLinkBots

func GetLinkBots() []string

获取 LinkBots 数组

func GetLinkPic

func GetLinkPic() string

获取 LinkPic

func GetLinkPrefix

func GetLinkPrefix() string

获取 LinkPrefix

func GetLinkText

func GetLinkText() string

获取 LinkText

func GetLogLevel

func GetLogLevel() int

获取GetSaveLogs的值

func GetLongQueryCommands

func GetLongQueryCommands() []string

获取例外指令

func GetLotusPassword

func GetLotusPassword() string

获取GetLotusPassword的值

func GetLotusValue

func GetLotusValue() bool

获取lotus的值

func GetMasterID

func GetMasterID() []string

获取MasterID数组

func GetMePrefix

func GetMePrefix() string

获取GetMePrefix的值

func GetMsgTimeOut

func GetMsgTimeOut() int

获取 GetMsgTimeOut 的值

func GetNativeOb11

func GetNativeOb11() bool

获取GetTransferUrl的值

func GetNgrokKey

func GetNgrokKey() string

获取 GetNgrokKey 的值

func GetNoWhiteResponse

func GetNoWhiteResponse() string

获取NoWhiteResponse的值

func GetOssType

func GetOssType() int

获取 Oss 模式

func GetPortValue

func GetPortValue() string

获取port的值

func GetPostMaxRetries

func GetPostMaxRetries() []int

获取 POST 最大重试次数数组

func GetPostRetriesInterval

func GetPostRetriesInterval() []int

获取 POST 重试间隔数组

func GetPostSecret

func GetPostSecret() []string

获取 POST 密钥数组

func GetPostUrl

func GetPostUrl() []string

获取 POST URL 数组

func GetQrSize

func GetQrSize() int

获取GetQrSize的值

func GetRamDomSeq

func GetRamDomSeq() bool

获取GetRamDomSeq的值

func GetReconnecTimes

func GetReconnecTimes() int

获取GetReconnecTimes的值

func GetRecordBitRate

func GetRecordBitRate() string

GetRecordBitRate 返回 RecordBitRate

func GetRegionID

func GetRegionID() string

GetRegionID 从 AliyunEndpoint 获取 regionId

func GetRemovePrefixValue

func GetRemovePrefixValue() bool

GetRemovePrefixValue 函数用于获取 remove_prefix 的配置值

func GetSaveLogs

func GetSaveLogs() bool

获取GetSaveLogs的值

func GetSelfIntroduce

func GetSelfIntroduce() []string

获取SelfIntroduce的值

func GetSendDelay

func GetSendDelay() int

获取send_delay的值

func GetSendDirectResponse

func GetSendDirectResponse() bool

获取 SendDirectResponse 的值

func GetSendError

func GetSendError() bool

获取GetSendError的值

func GetServerUserName

func GetServerUserName() string

GetServerUserName 获取服务器用户名

func GetServerUserPassword

func GetServerUserPassword() string

GetServerUserPassword 获取服务器用户密码

func GetServer_dir

func GetServer_dir() string

获取gensokyo服务的地址

func GetSubscribeMsgType

func GetSubscribeMsgType() int

GetSubScribeMsgType

func GetSubscribeMsgs

func GetSubscribeMsgs() []string

获取欢迎指令

func GetTencentAudit

func GetTencentAudit() bool

获取GetTencentAudit的值

func GetTencentBucketURL

func GetTencentBucketURL() string

GetTencentBucketURL 获取 TencentBucketURL

func GetTencentCosSecretid

func GetTencentCosSecretid() string

GetTencentCosSecretid 获取 TencentCosSecretid

func GetTencentSecretKey

func GetTencentSecretKey() string

GetTencentSecretKey 获取 TencentSecretKey

func GetTimeOut

func GetTimeOut() int

GetTimeOut

func GetTransFormApiIds

func GetTransFormApiIds() bool

获取 TransFormApiIds 的值

func GetTransferUrl

func GetTransferUrl() bool

获取GetTransferUrl的值

func GetTwoWayEcho

func GetTwoWayEcho() bool

获取双向ehco

func GetUinStr

func GetUinStr() string

获取Uin String

func GetUrlToQrimage

func GetUrlToQrimage() bool

获取GetUrlToQrimage的值

func GetUseNgrok

func GetUseNgrok() bool

获取 useNgrok 的值

func GetVisibleIP

func GetVisibleIP() bool

获取IPurl显示开启状态

func GetVwhitePrefixMode

func GetVwhitePrefixMode() bool

获取 VV GetVwhitePrefixMode 的值

func GetWhiteBypass

func GetWhiteBypass() []int64

获取白名单例外群数组

func GetWhiteBypassRevers

func GetWhiteBypassRevers() bool

获取GetWhiteBypassRevers的值

func GetWhitePrefixMode

func GetWhitePrefixMode() bool

获取白名单开启状态

func GetWhitePrefixs

func GetWhitePrefixs() []string

获取白名单指令数组

func GetWsAddress

func GetWsAddress() []string

获取ws地址数组

func GetWsServerPath

func GetWsServerPath() string

获取GetWsServerPath的值

func GetWsServerToken

func GetWsServerToken() string

获取WsServerToken的值

func GetWsToken

func GetWsToken() []string

获取WsToken

func SetBotID

func SetBotID(id string)

func UpdateConfig

func UpdateConfig(conf *Config, path string) error

UpdateConfig 将配置写入文件

func WriteYAMLToFile

func WriteYAMLToFile(yamlContent string) error

WriteYAMLToFile 将YAML格式的字符串写入到指定的文件路径

Types

type Config

type Config struct {
	Version  int      `yaml:"version"`
	Settings Settings `yaml:"settings"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig 从文件中加载配置并初始化单例配置

type Settings

type Settings struct {
	WsAddress              []string             `yaml:"ws_address"`
	BotToken               string               `yaml:"botToken"`
	WebHookPath            string               `yaml:"webHookPath"`
	TimeOut                int                  `yaml:"timeOut"`
	GlobalGroupOrPrivate   bool                 `yaml:"global_group_or_private"`
	Array                  bool                 `yaml:"array"`
	Server_dir             string               `yaml:"server_dir"`
	Lotus                  bool                 `yaml:"lotus"`
	Port                   string               `yaml:"port"`
	WsToken                []string             `yaml:"ws_token,omitempty"`         // 连接wss时使用,不是wss可留空 一一对应
	MasterID               []string             `yaml:"master_id,omitempty"`        // 如果需要在群权限判断是管理员是,将user_id填入这里,master_id是一个文本数组
	EnableWsServer         bool                 `yaml:"enable_ws_server,omitempty"` //正向ws开关
	WsServerToken          string               `yaml:"ws_server_token,omitempty"`  //正向ws token
	IdentifyFile           bool                 `yaml:"identify_file"`              // 域名校验文件
	Crt                    string               `yaml:"crt"`
	Key                    string               `yaml:"key"`
	DeveloperLog           bool                 `yaml:"developer_log"`
	Username               string               `yaml:"server_user_name"`
	Password               string               `yaml:"server_user_password"`
	ImageLimit             int                  `yaml:"image_sizelimit"`
	RemovePrefix           bool                 `yaml:"remove_prefix"`
	BackupPort             string               `yaml:"backup_port"`
	Title                  string               `yaml:"title"`
	HashID                 bool                 `yaml:"hash_id"`
	TwoWayEcho             bool                 `yaml:"twoway_echo"`
	WhitePrefixMode        bool                 `yaml:"white_prefix_mode"`
	WhitePrefixs           []string             `yaml:"white_prefixs"`
	BlackPrefixMode        bool                 `yaml:"black_prefix_mode"`
	BlackPrefixs           []string             `yaml:"black_prefixs"`
	VisualPrefixs          []VisualPrefixConfig `yaml:"visual_prefixs"`
	VisibleIp              bool                 `yaml:"visible_ip"`
	ForwardMsgLimit        int                  `yaml:"forward_msg_limit"`
	LogLevel               int                  `yaml:"log_level"`
	SaveLogs               bool                 `yaml:"save_logs"`
	BindPrefix             string               `yaml:"bind_prefix"`
	MePrefix               string               `yaml:"me_prefix"`
	ImageLimitB            int                  `yaml:"image_limit"`
	RecordBitRate          string               `yaml:"record_bitRate"`
	NoWhiteResponse        string               `yaml:"No_White_Response"`
	SendError              bool                 `yaml:"send_error"`
	LotusPassword          string               `yaml:"lotus_password"`
	WsServerPath           string               `yaml:"ws_server_path"`
	IdmapPro               bool                 `yaml:"idmap_pro"`
	CardAndNick            string               `yaml:"card_nick"`
	CustomBotName          string               `yaml:"custom_bot_name"`
	SendDelay              int                  `yaml:"send_delay"`
	ReconnecTimes          int                  `yaml:"reconnect_times"`
	HeartBeatInterval      int                  `yaml:"heart_beat_interval"`
	LaunchReconectTimes    int                  `yaml:"launch_reconnect_times"`
	WhiteBypass            []int64              `yaml:"white_bypass"`
	TransferUrl            bool                 `yaml:"transfer_url"`
	HttpAddress            string               `yaml:"http_address"`
	HttpVersion            int                  `yaml:"http_version"`
	HttpTimeOut            int                  `yaml:"http_timeout"`
	PostUrl                []string             `yaml:"post_url"`
	PostSecret             []string             `yaml:"post_secret"`
	PostMaxRetries         []int                `yaml:"post_max_retries"`
	PostRetriesInterval    []int                `yaml:"post_retries_interval"`
	NativeOb11             bool                 `yaml:"native_ob11"`
	RamDomSeq              bool                 `yaml:"ramdom_seq"`
	UrlToQrimage           bool                 `yaml:"url_to_qrimage"`
	QrSize                 int                  `yaml:"qr_size"`
	WhiteBypassRevers      bool                 `yaml:"white_bypass_reverse"`
	TencentBucketName      string               `yaml:"t_COS_BUCKETNAME"`
	TencentBucketRegion    string               `yaml:"t_COS_REGION"`
	TencentCosSecretid     string               `yaml:"t_COS_SECRETID"`
	TencentSecretKey       string               `yaml:"t_COS_SECRETKEY"`
	TencentAudit           bool                 `yaml:"t_audit"`
	OssType                int                  `yaml:"oss_type"`
	BaiduBOSBucketName     string               `yaml:"b_BOS_BUCKETNAME"`
	BaiduBCEAK             string               `yaml:"b_BCE_AK"`
	BaiduBCESK             string               `yaml:"b_BCE_SK"`
	BaiduAudit             int                  `yaml:"b_audit"`
	AliyunEndpoint         string               `yaml:"a_OSS_EndPoint"`
	AliyunAccessKeyId      string               `yaml:"a_OSS_AccessKeyId"`
	AliyunAccessKeySecret  string               `yaml:"a_OSS_AccessKeySecret"`
	AliyunBucketName       string               `yaml:"a_OSS_BucketName"`
	AliyunAudit            bool                 `yaml:"a_audit"`
	Alias                  []string             `yaml:"alias"`
	SelfIntroduce          []string             `yaml:"self_introduce"`
	IdentifyAppids         []int64              `yaml:"identify_appids"`
	TransFormApiIds        bool                 `yaml:"transform_api_ids"`
	CustomTemplateID       string               `yaml:"custom_template_id"`
	KeyBoardID             string               `yaml:"keyboard_id"`
	Uin                    int64                `yaml:"uin"`
	VwhitePrefixMode       bool                 `yaml:"v_white_prefix_mode"`
	Enters                 []string             `yaml:"enters"`
	LinkPrefix             string               `yaml:"link_prefix"`
	LinkBots               []string             `yaml:"link_bots"`
	LinkText               string               `yaml:"link_text"`
	LinkPic                string               `yaml:"link_pic"`
	DefaultContent         []string             `yaml:"default_content"`
	DefaultDailyReplyLimit int                  `yaml:"default_daily_reply_limit"`
	LongQueryCommands      []string             `yaml:"long_query_commands"`
	SubScribeMsgType       int                  `yaml:"subscribe_msg_type"`
	SubscribeMsgs          []string             `yaml:"subscribe_msgs"`
	CustomCert             bool                 `yaml:"customcert"`
	UseNgrok               bool                 `yaml:"useNgrok"`
	HttpGetMsg             bool                 `yaml:"httpGetMsg"`
	GetMsgTimeOut          int                  `yaml:"getMsgTimeOut"`
	NgrokKey               string               `yaml:"ngrokKey"`
	HighWay                bool                 `yaml:"highway"`
	SendDirectResponse     bool                 `yaml:"sendDirectResponse"`
}

type VisualPrefixConfig

type VisualPrefixConfig struct {
	Prefix          string   `yaml:"prefix"`
	WhiteList       []string `yaml:"whiteList"`
	NoWhiteResponse string   `yaml:"No_White_Response"`
}

func GetVisualkPrefixs

func GetVisualkPrefixs() []VisualPrefixConfig

修改 GetVisualkPrefixs 函数以返回新类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL