Documentation ¶
Overview ¶
Package config holds everything related to configuration
Package config holds everything related to configuration
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Token is the token value of the bot Token string // BotName contains the @name of the bot after initializing in an account BotName string )
View Source
var ( // Phrases is the list of predefined phrases to say randomly Phrases = []string{} // CionList is the list of words ending with "cion" CionList map[string]bool )
View Source
var AutoEnableTimer map[int64]*time.Timer
Contains the timers for the automatic conversation enabled
Functions ¶
func EnabledChatConfig ¶
EnabledChatConfig enable/disable the bot answer
func FindAllChatConfigWithId ¶
func FindAllChatConfigWithId() (map[int64]ChatConfig, error)
FindAllChatConfigWithId Return all the ChatConfig in a map with the chatId
func ScheduleAutoEnable ¶
ScheduleAutoEnable schedule the auto enable chatConfig
func UpdateChatConfig ¶
func UpdateChatConfig(chatId int64, input *ChatConfig) error
UpdateChatConfig Persist the ChatConfig for the chatId
Types ¶
type ChatConfig ¶
type ChatConfig struct { // Enabled defines if the bot should answer Enabled bool // DisableUntil defines until bot should not answer DisableUntil time.Time // PercentAnswer is the probability of anwser to any update PercentAnswer int // IsGroup is true if the related chat is a group IsGroup bool // Pole is true if the bot should say "Pole" every day Pole bool }
ChatConfig contains the base configuration for a single chat
func CreateChatConfig ¶
func CreateChatConfig(chatId int64, isGroup bool) *ChatConfig
CreateChatConfig Initialize the ChatConfig for the chatId and persist it
func FindChatConfig ¶
func FindChatConfig(chatId int64) (res *ChatConfig, err error)
FindChatConfig Find the ChatConfig for the chatId
func NewChatConfig ¶
func NewChatConfig(isGroup bool) *ChatConfig
NewChatConfig creates a default chat configuration
Click to show internal directories.
Click to hide internal directories.