consts

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBHostCompose = "host=betago_pg"
	// DBHostCluster k8s的PGHost
	DBHostCluster = "host=kubernetes.default"
	// DBHostTest 本地测试的PGHost
	DBHostTest = "host=localhost"
)

Database

View Source
const (
	TimeFormat = "2006-01-02T15:04:05"
	// BetaGoUpdateChanID  发送更新消息的频道ID
	BetaGoUpdateChanID = "6422768213722929"

	// ImagePath 图片存储路径
	ImagePath = "/data/images"

	// ChatPath 对话信息存储路径
	ChatPath = "/data/chat/chat.dump"

	// FontPath  字体存储路径
	FontPath = "/data/fonts"

	// PublicIPURL 获取公网IP的URL
	PublicIPURL = "http://ifconfig.me"

	// SelfCheckMessage 自我健康检查
	SelfCheckMessage = "self check message"
)
View Source
const (
	ShortCommandShowCal      = "SC"
	ShortCommandShowCalLocal = "SCL"
	ShortCommandShowAdmin    = "SA"
	ShortCommandReconnect    = "RC"
	ShortCommandAddAdmin     = "AA"
	ShortCommandRemoveAdmin  = "RA"
	ShortCommandHelp         = "H"
	ShortCommandPing         = "P"
	ShortCommandRoll         = "R"
	ShortCommandHitokoto     = "HI"
	ShortCommandMusic        = "M"
)

var 短命令参数

View Source
const (
	// MemberJoined 新成员加入Type
	MemberJoined = "joined_guild"

	// MemberExited 成员退出Type
	MemberExited = "exited_guild"

	// MemberUpdate 成员信息更新Type
	MemberUpdate = "updated_guild_member"

	// MemberOnline 成员上线Type
	MemberOnline = "guild_member_online"

	// MemberOffline 成员离线Type
	MemberOffline = "guild_member_offline"

	// ChannelAddReaction 频道内用户添加 reaction
	ChannelAddReaction = "added_reaction"

	// ChannelDelReaction 频道内用户取消 reaction
	ChannelDelReaction = "deleted_reaction"

	// ChannelMessageUpdate 频道消息更新
	ChannelMessageUpdate = "updated_message"

	// ChannelMessageRemove 频道消息被删除
	ChannelMessageRemove = "deleted_message"

	// ChannelAdded 新增频道
	ChannelAdded = "added_channel"

	// ChannelModified 修改频道
	ChannelModified = "added_channel"

	// ChannelDeleted 删除频道
	ChannelDeleted = "deleted_channel"

	// ChannelTopMessage 新增频道置顶消息
	ChannelTopMessage = "pinned_message"

	// ChannelTopMessageCancel 取消频道置顶消息
	ChannelTopMessageCancel = "unpinned_message"
)
View Source
const (
	LarkResourceTypeImage   string = "image"
	LarkResourceTypeSticker string = "sticker"
)
View Source
const (
	MODEL_TYPE_REASON = "reason"
	MODEL_TYPE_NORMAL = "normal"
)
View Source
const (
	BotOpenID = "ou_8817f540f718affd21718f415b81597f"
)
View Source
const LarkMsgIndex = "lark_msg_index_jieba"
View Source
const (
	NetEaseAPIDomainCompose = "http://n"
)

Variables

View Source
var (
	NotifierChanID = "2472013302648680"
	BotIdentifier  = os.Getenv("BOT_IDENTIFY")
)

NotifierChanID 发送消息的频道ID

View Source
var (
	CommitMessage = os.Getenv("COM_MES")
	HTMLURL       = os.Getenv("HTML_URL")
	CommentsURL   = os.Getenv("COM_URL")
	RobotName     = os.Getenv("ROBOT_NAME")
	RobotID       = os.Getenv("ROBOT_ID")
	TestChanID    = os.Getenv("TEST_CHAN_ID")
	BetaGoTest    = os.Getenv("IS_TEST") == "true"
	IsTest        = os.Getenv("IS_TEST") == "true"
	IsCluster     = os.Getenv("IS_CLUSTER") == "true"
	IsCompose     = os.Getenv("IS_COMPOSE") == "true"
	CommandPrefix = "(met)" + RobotID + "(met)"
)

环境变量

View Source
var (
	ErrStageSkip         = errors.New("Stage Skip")
	ErrStageError        = errors.New("Stage Error")
	ErrStageWarn         = errors.New("Stage Warn")
	ErrArgsIncompelete   = errors.New("ArgsIncompeleteError")
	ErrCommandNotFound   = errors.New("CommandNotFoundError")
	ErrCommandIncomplete = errors.New("CommandIncompleteError")

	ErrCheckUsage = errors.New("Usage")
)
View Source
var (
	HttpClient          = resty.New()
	HttpClientWithProxy = resty.New().SetProxy(os.Getenv("PRIVATE_PROXY"))
)
View Source
var ErrorOverReq = fmt.Errorf("每秒仅允许5次请求,请求过快,请稍后重试")
View Source
var FlowControl = &FlowControlType{}
View Source
var GlobalDBConn *gorm.DB

GlobalDBConn 全局数据库连接

View Source
var GlobalSession = kook.New(os.Getenv("BOTAPI"), plog.NewLogger(&log.Logger{
	Level:  log.InfoLevel,
	Writer: &log.ConsoleWriter{},
}))

GlobalSession 全局共享session

View Source
var ReconnectChan = make(chan string)

ReconnectChan 1

View Source
var SelfCheckChan = make(chan string, 1)

SelfCheckChan 自我检查通道

Functions

This section is empty.

Types

type CardMessageColModule

type CardMessageColModule struct {
	Type string `json:"type"`
	Text []struct {
		Type   string `json:"type"`
		Cols   int    `json:"cols"`
		Fields []struct {
			Type    string `json:"type"`
			Content string `json:"content"`
		}
	}
}

CardMessageColModule khl cardmessage Col

type CardMessageModule

type CardMessageModule struct {
	Type  string `json:"type"`
	Title string `json:"title"`
	Src   string `json:"src"`
	Cover string `json:"cover"`
}

CardMessageModule khl cardmessage

type CardMessageTextModule

type CardMessageTextModule struct {
	Type string `json:"type"`
	Text struct {
		Type    string `json:"type"`
		Content string `json:"content"`
	} `json:"text"`
}

CardMessageTextModule khl cardmessage Text

type FlowControlType

type FlowControlType struct {
	M   sync.RWMutex
	Cnt int
}

func (*FlowControlType) Add

func (fc *FlowControlType) Add()

func (*FlowControlType) Sub

func (fc *FlowControlType) Sub()

func (*FlowControlType) Top

func (fc *FlowControlType) Top() (err error)

type LarkFunctionEnum

type LarkFunctionEnum string
const (
	LarkFunctionWordReply    LarkFunctionEnum = "word_reply"
	LarkFunctionRandomReact  LarkFunctionEnum = "random_react"
	LarkFunctionRandomRepeat LarkFunctionEnum = "random_repeat"
)

type LarkInteraction

type LarkInteraction string
const (
	LarkInteractionSendMsg     LarkInteraction = "send_msg"
	LarkInteractionAddReaction LarkInteraction = "add_reaction"
	LarkInteractionCallBot     LarkInteraction = "call_bot"
)

type ReplyType

type ReplyType string
const (
	ReplyTypeText ReplyType = "text"
	ReplyTypeImg  ReplyType = "img"
)

type WordMatchType

type WordMatchType string
const (
	MatchTypeSubStr WordMatchType = "substr"
	MatchTypeRegex  WordMatchType = "regex"
	MatchTypeFull   WordMatchType = "full"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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