ReadConfig

package
v1.0.0-beta.23 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-01-24 19:35:15 * @LastEditTime: 2022-03-07 19:48:36 * @LastEditors: NyanCatda * @Description: 配置文件结构体 * @FilePath: \ShionBot\Utils\ReadConfig\ConfigStruct.go

* @Author: NyanCatda * @Date: 2021-10-03 04:14:10 * @LastEditTime: 2022-03-07 19:50:26 * @LastEditors: NyanCatda * @Description: 读取配置文件 * @FilePath: \ShionBot\Utils\ReadConfig\ReadConfig.go

Index

Constants

This section is empty.

Variables

View Source
var (
	GetConfig  *Config
	ConfigPath string
)

Functions

func GetWikiLink(SNSName string, Messagejson Struct.WebHookJson, WikiName string) string

*

  • @description: 读取Wiki名字对应的Wiki链接
  • @param {string} SNSName 聊天软件名字
  • @param {Struct.WebHookJson} Messagejson 消息Json
  • @param {string} WikiName Wiki名字
  • @return {*}

func LoadConfig

func LoadConfig() error

加载配置文件

Types

type Config

type Config struct {
	Run struct {
		WebHookPort string `yaml:"WebHookPort"`
		WebHookKey  string `yaml:"WebHookKey"`
		Language    string `yaml:"Language"`
	} `yaml:"Run"`
	SNS struct {
		QQ struct {
			Switch      bool   `yaml:"Switch"`
			APILink     string `yaml:"APILink"`
			BotQQNumber int    `yaml:"BotQQNumber"`
			VerifyKey   string `yaml:"VerifyKey"`
		} `yaml:"QQ"`
		Telegram struct {
			Switch     bool   `yaml:"Switch"`
			Token      string `yaml:"Token"`
			BotAPILink string `yaml:"BotAPILink"`
		} `yaml:"Telegram"`
		Line struct {
			Switch             bool   `yaml:"Switch"`
			ChannelAccessToken string `yaml:"ChannelAccessToken"`
			BotAPILink         string `yaml:"BotAPILink"`
		} `yaml:"Line"`
		KaiHeiLa struct {
			Switch bool   `yaml:"Switch"`
			Token  string `yaml:"Token"`
		} `yaml:"KaiHeiLa"`
	} `yaml:"SNS"`
	Wiki []struct {
		WikiName string `yaml:"WikiName"`
		WikiLink string `yaml:"WikiLink"`
	} `yaml:"Wiki"`
}

func (*Config) CheckConfig

func (value *Config) CheckConfig() error

*

  • @description: 检查配置文件字段是否为空
  • @param {*}
  • @return {error}

Jump to

Keyboard shortcuts

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