config

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: BSL-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIHash

func GetAPIHash() string

GetAPIHash get API Hash

func GetAPIID

func GetAPIID() string

GetAPIID get API ID

func GetBeefWebPort

func GetBeefWebPort() int

GetBeefWebPort get Beefweb port

func GetBotToken

func GetBotToken() string

GetBotToken get bot token

func GetChatID

func GetChatID() int64

GetChatID get chat ID

func GetChatSelectLimit

func GetChatSelectLimit() int

GetChatSelectLimit get select limit of group chat

func GetChatUsername

func GetChatUsername() string

GetChatUsername get chat username

func GetPinnedMessage

func GetPinnedMessage() int64

GetPinnedMessage get pinned message ID

func GetPlaylistID

func GetPlaylistID() string

GetPlaylistID get playlist ID

func GetPrivateChatSelectLimit

func GetPrivateChatSelectLimit() int

GetPrivateChatSelectLimit get select limit of private chat

func GetQueueLimit

func GetQueueLimit() int

GetQueueLimit get queue song limit

func GetRecentLimit

func GetRecentLimit() int

GetRecentLimit get recent song limit

func GetReleaseTime

func GetReleaseTime() int64

GetReleaseTime get lock the vote seconds after vote ended

func GetReqSongLimit

func GetReqSongLimit() int

GetReqSongLimit get request song limit

func GetRowLimit

func GetRowLimit() int

GetRowLimit get row limit

func GetSuccessRate

func GetSuccessRate() float64

GetSuccessRate get vote success rate

func GetUpdateTime

func GetUpdateTime() int32

GetUpdateTime get vote update time

func GetVoteTime

func GetVoteTime() int32

GetVoteTime get vote time

func GetWebPort

func GetWebPort() int

GetWebPort get web port

func IsJoinNeeded

func IsJoinNeeded() bool

IsJoinNeeded return true if only users which are in the group can vote

func IsPtcpsOnly

func IsPtcpsOnly() bool

IsPtcpsOnly return true if only participants which are in a voice chat can vote

func IsVoteEnabled

func IsVoteEnabled() bool

IsVoteEnabled return true if vote is enabled

func IsWebEnabled

func IsWebEnabled() bool

IsWebEnabled return true if userbot mode is disabled

func LoadConfig

func LoadConfig() error

LoadConfig load config.json to Config

func Read

func Read()

Read read config and status JSON

func Save

func Save()

Save save current status and config to file

func SaveConfig

func SaveConfig()

SaveConfig save and indent Config to config.json

func SaveStatus

func SaveStatus()

SaveStatus save and indent Status to status.json

func SetChatID

func SetChatID(value int64)

SetChatID update chat ID

func SetChatSelectLimit added in v1.0.4

func SetChatSelectLimit(value int)

SetChatSelectLimit set select limit of group chat

func SetCurrentSong

func SetCurrentSong(value string)

SetCurrentSong set current song

func SetJoinEnable added in v1.0.4

func SetJoinEnable(value bool)

SetJoinEnable update user must join

func SetPinnedMessage

func SetPinnedMessage(value int64)

SetPinnedMessage update pinned message ID

func SetPrivateChatSelectLimit added in v1.0.4

func SetPrivateChatSelectLimit(value int)

SetPrivateChatSelectLimit set select limit of private chat

func SetPtcpEnable added in v1.0.4

func SetPtcpEnable(value bool)

SetPtcpEnable update participants only

func SetQueueLimit added in v1.0.4

func SetQueueLimit(value int)

SetQueueLimit set queue song limit

func SetQueueSong

func SetQueueSong(value []int)

SetQueueSong set queue song list

func SetRecentLimit added in v1.0.4

func SetRecentLimit(value int)

SetRecentLimit set recent song limit

func SetRecentSong

func SetRecentSong(value []int)

SetRecentSong set recent song list

func SetReleaseTime added in v1.0.4

func SetReleaseTime(value int64)

SetReleaseTime set lock the vote seconds after vote ended

func SetReqSongLimit added in v1.0.4

func SetReqSongLimit(value int)

SetReqSongLimit set request song limit

func SetRowLimit added in v1.0.4

func SetRowLimit(value int)

SetRowLimit set row limit

func SetSuccessRate added in v1.0.4

func SetSuccessRate(value float64)

SetSuccessRate set vote success rate

func SetUpdateTime added in v1.0.2

func SetUpdateTime(value int32)

SetUpdateTime update the vote update time

func SetVoteEnable added in v1.0.4

func SetVoteEnable(value bool)

SetVoteEnable set vote on or off

func SetVoteTime added in v1.0.2

func SetVoteTime(value int32)

SetVoteTime update the vote time

Types

type Config

type Config struct {
	ApiId        string `json:"api_id"`
	ApiHash      string `json:"api_hash"`
	BotToken     string `json:"bot_token"`
	ChatId       int64  `json:"chat_id"`
	ChatUsername string `json:"chat_username"`
	PinnedMsg    int64  `json:"pinned_message"`
	BeefwebPort  int    `json:"beefweb_port"`
	PlaylistId   string `json:"playlist_id"`
	LimitSetting Limit  `json:"limit"`
	VoteSetting  Vote   `json:"vote"`
	WebSetting   Web    `json:"web"`
}

Config config JSON strust

func GetConfig

func GetConfig() Config

GetConfig get current config

type Limit

type Limit struct {
	ChatSelectLimit int `json:"chat_select_limit"`
	PriSelectLimit  int `json:"private_select_limit"`
	RowLimit        int `json:"row_limit"`
	QueueLimit      int `json:"queue_limit"`
	RecentLimit     int `json:"recent_limit"`
	ReqSongPerMin   int `json:"request_song_per_minute"`
}

Limit limit setting JSON struct

type Status

type Status struct {
	Current string `json:"current"`
	Queue   []int  `json:"queue"`
	Recent  []int  `json:"recent"`
}

Status status JSON struct

func GetStatus

func GetStatus() Status

GetStatus get current status

func (Status) GetCurrent

func (s Status) GetCurrent() string

GetCurrent get current song

func (Status) GetQueue

func (s Status) GetQueue() []int

GetQueue get queue song list

func (Status) GetRecent

func (s Status) GetRecent() []int

GetRecent get recent song list

type Vote

type Vote struct {
	Enable       bool    `json:"enable"`
	VoteTime     int32   `json:"vote_time"`
	UpdateTime   int32   `json:"update_time"`
	ReleaseTime  int64   `json:"release_time"`
	PctOfSuccess float64 `json:"percent_of_success"`
	PtcpsOnly    bool    `json:"participants_only"`
	UserMustJoin bool    `json:"user_must_join"`
}

Vote vote setting JSON struct

type Web

type Web struct {
	Enable bool `json:"enable"`
	Port   int  `json:"port"`
}

Web web setting JSON struct

Jump to

Keyboard shortcuts

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