Documentation
¶
Index ¶
- Constants
- func AddBlacklist(chatId int64, trigger string)
- func AddDev(userID int64)
- func AddFilter(chatID int64, keyWord, replyText, fileID string, buttons []Button, ...)
- func AddNote(chatID int64, noteName, replyText, fileID string, buttons []Button, ...)
- func AddSudo(userID int64)
- func BlockReportUser(chatId, userId int64)
- func ChangeGroupLanguage(GroupID int64, lang string)
- func ChangeUserLanguage(UserID int64, lang string)
- func ConnectId(UserID, chatID int64)
- func CountFilters(chatID int64) (filtersNum int64)
- func DisableCMD(chatID int64, cmd string)
- func DisconnectId(UserID int64)
- func DoesFilterExists(chatId int64, keyword string) bool
- func DoesNoteExists(chatID int64, noteName string) bool
- func EnableCMD(chatID int64, cmd string)
- func EnsureBotInDb(b *gotgbot.Bot)
- func GetAllChatWarns(chatId int64) int
- func GetAllChats() map[int64]Chat
- func GetChannelIdByUserName(username string) int64
- func GetChannelInfoById(userId int64) (username, name string, found bool)
- func GetChatDisabledCMDs(chatId int64) []string
- func GetFiltersList(chatID int64) (allFilterWords []string)
- func GetLanguage(ctx *ext.Context) string
- func GetNotesList(chatID int64, admin bool) (allNotes []string)
- func GetTeamMembers() map[int64]string
- func GetUserIdByUserName(username string) int64
- func GetUserInfoById(userId int64) (username, name string, found bool)
- func GetWarns(userId, chatId int64) (int, []string)
- func IsCommandDisabled(chatId int64, cmd string) bool
- func IsPermLocked(chatID int64, perm string) bool
- func LoadAllStats() string
- func LoadAntifloodStats() (antiCount int64)
- func LoadBlacklistsStats() (blacklistTriggers, blacklistChats int64)
- func LoadChannelStats() (count int64)
- func LoadChatStats() (activeChats, inactiveChats int)
- func LoadConnectionStats() (connectedUsers, connectedChats int64)
- func LoadDisableStats() (disabledCmds, disableEnabledChats int64)
- func LoadFilterStats() (filtersNum, filtersUsingChats int64)
- func LoadGreetingsStats() (...)
- func LoadNotesStats() (notesNum, notesUsingChats int64)
- func LoadPinStats() (acCount, clCount int64)
- func LoadReportStats() (uRCount, gRCount int64)
- func LoadRulesStats() (setRules, pvtRules int64)
- func LoadUsersStats() (count int64)
- func MapLockType(locks Locks) map[string]bool
- func ReconnectId(UserID int64) int64
- func RemDev(userID int64)
- func RemSudo(userID int64)
- func RemoveAllBlacklist(chatId int64)
- func RemoveAllFilters(chatID int64)
- func RemoveAllNotes(chatID int64)
- func RemoveBlacklist(chatId int64, trigger string)
- func RemoveFilter(chatID int64, keyWord string)
- func RemoveNote(chatID int64, noteName string)
- func RemoveWarn(userId, chatId int64) bool
- func ResetAllChatWarns(chatId int64) bool
- func ResetUserWarns(userId, chatId int64) (removed bool)
- func SetAnonAdminMode(chatID int64, val bool)
- func SetAntiChannelPin(chatID int64, pref bool)
- func SetBlacklistAction(chatId int64, action string)
- func SetChatReportStatus(chatID int64, pref bool)
- func SetChatRules(chatId int64, rules string)
- func SetChatRulesButton(chatId int64, rulesButton string)
- func SetCleanGoodbyeMsgId(chatId, msgId int64)
- func SetCleanGoodbyeSetting(chatID int64, pref bool)
- func SetCleanLinked(chatID int64, pref bool)
- func SetCleanWelcomeMsgId(chatId, msgId int64)
- func SetCleanWelcomeSetting(chatID int64, pref bool)
- func SetFlood(chatID int64, limit int)
- func SetFloodMode(chatID int64, mode string)
- func SetFloodMsgDel(chatID int64, val bool)
- func SetGoodbyeText(chatID int64, goodbyetext, fileId string, buttons []Button, goodbyeType int)
- func SetGoodbyeToggle(chatID int64, pref bool)
- func SetPrivateRules(chatId int64, pref bool)
- func SetShouldAutoApprove(chatID int64, pref bool)
- func SetShouldCleanService(chatID int64, pref bool)
- func SetUserReportSettings(chatID int64, pref bool)
- func SetWarnLimit(chatId int64, warnLimit int)
- func SetWarnMode(chatId int64, warnMode string)
- func SetWelcomeText(chatID int64, welcometxt, fileId string, buttons []Button, welcType int)
- func SetWelcomeToggle(chatID int64, pref bool)
- func ShouldDel(chatId int64) bool
- func ToggleAllowConnect(chatID int64, pref bool)
- func ToggleDel(chatId int64, pref bool)
- func ToggleInactiveChat(chatId int64, toggle bool)
- func TooglePrivateNote(chatID int64, pref bool)
- func UnblockReportUser(chatId, userId int64)
- func UpdateChannel(channelId int64, channelName, username string)
- func UpdateChat(chatId int64, chatname string, userid int64)
- func UpdateLock(chatID int64, perm string, val bool)
- func UpdateUser(userId int64, username, name string)
- func WarnUser(userId, chatId int64, reason string) (int, []string)
- type AdminSettings
- type BlacklistSettings
- type Button
- type Channel
- type Chat
- type ChatFilters
- type ChatNotes
- type ChatReportSettings
- type ConnectionSettings
- type Connections
- type DisableCommand
- type FloodSettings
- type GoodbyeSettings
- type GreetingSettings
- type Locks
- type NoteSettings
- type Permissions
- type Pins
- type Restrictions
- type Rules
- type Team
- type User
- type UserReportSettings
- type WarnSettings
- type Warns
- type WelcomeSettings
Constants ¶
View Source
const ( // TEXT types of senders TEXT int = 1 STICKER int = 2 DOCUMENT int = 3 PHOTO int = 4 AUDIO int = 5 VOICE int = 6 VIDEO int = 7 VideoNote int = 8 )
View Source
const ( DefaultWelcome = "Hey {first}, how are you?" DefaultGoodbye = "Sad to see you leaving {first}" )
default strings when no settings are set
Variables ¶
This section is empty.
Functions ¶
func AddBlacklist ¶
func BlockReportUser ¶
func BlockReportUser(chatId, userId int64)
func ChangeGroupLanguage ¶
func ChangeUserLanguage ¶
func CountFilters ¶
func DisconnectId ¶
func DisconnectId(UserID int64)
func DoesFilterExists ¶
func DoesNoteExists ¶
func EnsureBotInDb ¶
func EnsureBotInDb(b *gotgbot.Bot)
func GetAllChatWarns ¶
func GetAllChats ¶
func GetChannelIdByUserName ¶
func GetChannelInfoById ¶
func GetChatDisabledCMDs ¶
GetChatDisabledCMDs Get disabled comands of chat
func GetFiltersList ¶
func GetLanguage ¶
func GetNotesList ¶
func GetTeamMembers ¶
func GetUserIdByUserName ¶
func GetUserInfoById ¶
func IsCommandDisabled ¶
IsCommandDisabled Check if command is disabled or not
func IsPermLocked ¶
func LoadAllStats ¶
func LoadAllStats() string
func LoadAntifloodStats ¶
func LoadAntifloodStats() (antiCount int64)
func LoadBlacklistsStats ¶
func LoadBlacklistsStats() (blacklistTriggers, blacklistChats int64)
func LoadChannelStats ¶
func LoadChannelStats() (count int64)
func LoadChatStats ¶
func LoadChatStats() (activeChats, inactiveChats int)
func LoadConnectionStats ¶
func LoadConnectionStats() (connectedUsers, connectedChats int64)
func LoadDisableStats ¶
func LoadDisableStats() (disabledCmds, disableEnabledChats int64)
func LoadFilterStats ¶
func LoadFilterStats() (filtersNum, filtersUsingChats int64)
func LoadGreetingsStats ¶
func LoadGreetingsStats() (enabledWelcome, enabledGoodbye, cleanServiceEnabled, cleanWelcomeEnabled, cleanGoodbyeEnabled int64)
func LoadNotesStats ¶
func LoadNotesStats() (notesNum, notesUsingChats int64)
func LoadPinStats ¶
func LoadPinStats() (acCount, clCount int64)
func LoadReportStats ¶
func LoadReportStats() (uRCount, gRCount int64)
func LoadRulesStats ¶
func LoadRulesStats() (setRules, pvtRules int64)
func LoadUsersStats ¶
func LoadUsersStats() (count int64)
func MapLockType ¶
func ReconnectId ¶
func RemoveAllBlacklist ¶
func RemoveAllBlacklist(chatId int64)
func RemoveAllFilters ¶
func RemoveAllFilters(chatID int64)
func RemoveAllNotes ¶
func RemoveAllNotes(chatID int64)
func RemoveBlacklist ¶
func RemoveFilter ¶
func RemoveNote ¶
func RemoveWarn ¶
func ResetAllChatWarns ¶
func ResetUserWarns ¶
func SetAnonAdminMode ¶
SetAnonAdminMode Set anon admin mode for a chat
func SetAntiChannelPin ¶
func SetBlacklistAction ¶
func SetChatReportStatus ¶
func SetChatRules ¶
func SetChatRulesButton ¶
func SetCleanGoodbyeMsgId ¶
func SetCleanGoodbyeMsgId(chatId, msgId int64)
func SetCleanGoodbyeSetting ¶
func SetCleanLinked ¶
func SetCleanWelcomeMsgId ¶
func SetCleanWelcomeMsgId(chatId, msgId int64)
func SetCleanWelcomeSetting ¶
func SetFloodMode ¶
SetFloodMode Set flood mode for a chat
func SetFloodMsgDel ¶
SetFloodMsgDel Set flood mode for a chat
func SetGoodbyeText ¶
func SetGoodbyeToggle ¶
func SetPrivateRules ¶
func SetShouldAutoApprove ¶
func SetShouldCleanService ¶
func SetUserReportSettings ¶
func SetWarnLimit ¶
func SetWarnMode ¶
func SetWelcomeText ¶
func SetWelcomeToggle ¶
func ToggleAllowConnect ¶
func ToggleInactiveChat ¶
func TooglePrivateNote ¶
func UnblockReportUser ¶
func UnblockReportUser(chatId, userId int64)
func UpdateChannel ¶
func UpdateChat ¶
func UpdateLock ¶
UpdateLock Modify the value of Locks struct and update it in database
func UpdateUser ¶
Types ¶
type AdminSettings ¶
type AdminSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` AnonAdmin bool `bson:"anon_admin" json:"anon_admin"` }
AdminSettings Flood Settings struct for chat
func GetAdminSettings ¶
func GetAdminSettings(chatID int64) *AdminSettings
GetAdminSettings Get admin settings for a chat
type BlacklistSettings ¶
type BlacklistSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Action string `bson:"action,omitempty" json:"action,omitempty"` Triggers []string `bson:"triggers,omitempty" json:"triggers,omitempty"` Reason string `bson:"reason,omitempty" json:"reason,omitempty"` }
BlacklistSettings Flood Control struct for user
func GetBlacklistSettings ¶
func GetBlacklistSettings(chatId int64) *BlacklistSettings
type Button ¶
type Button struct { Name string `bson:"name,omitempty" json:"name,omitempty"` Url string `bson:"url,omitempty" json:"url,omitempty"` SameLine bool `bson:"btn_sameline" json:"btn_sameline" default:"false"` }
func GetGoodbyeButtons ¶
func GetWelcomeButtons ¶
type Channel ¶
type Channel struct { ChannelId int64 `bson:"_id,omitempty" json:"_id,omitempty"` ChannelName string `bson:"channel_name" json:"channel_name" default:"nil"` Username string `bson:"username" json:"username" default:"nil"` }
func GetChannelSettings ¶
type Chat ¶
type Chat struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` ChatName string `bson:"chat_name" json:"chat_name" default:"nil"` Language string `bson:"language" json:"language" default:"nil"` Users []int64 `bson:"users" json:"users" default:"nil"` IsInactive bool `bson:"is_inactive" json:"is_inactive" default:"false"` }
func GetChatSettings ¶
type ChatFilters ¶
type ChatFilters struct { ChatId int64 `bson:"chat_id,omitempty" json:"chat_id,omitempty"` KeyWord string `bson:"keyword,omitempty" json:"keyword,omitempty"` FilterReply string `bson:"filter_reply,omitempty" json:"filter_reply,omitempty"` MsgType int `bson:"msgtype,omitempty" json:"msgtype,omitempty"` FileID string `bson:"fileid,omitempty" json:"fileid,omitempty"` NoNotif bool `bson:"nonotif,omitempty" json:"nonotif,omitempty"` Buttons []Button `bson:"filter_buttons,omitempty" json:"filter_buttons,omitempty"` }
func GetAllFilters ¶
func GetAllFilters(chatID int64) (allFilters []*ChatFilters)
func GetFilter ¶
func GetFilter(chatID int64, keyword string) (filtSrc *ChatFilters)
type ChatNotes ¶
type ChatNotes struct { ChatId int64 `bson:"chat_id,omitempty" json:"chat_id,omitempty"` NoteName string `bson:"note_name,omitempty" json:"note_name,omitempty"` NoteContent string `bson:"note_content,omitempty" json:"note_content,omitempty"` MsgType int `bson:"msgtype" json:"msgtype" default:"1"` FileID string `bson:"fileid,omitempty" json:"fileid,omitempty"` PrivateOnly bool `bson:"private_only,omitempty" json:"private_only,omitempty"` GroupOnly bool `bson:"group_only,omitempty" json:"group_only,omitempty"` AdminOnly bool `bson:"admin_only,omitempty" json:"admin_only,omitempty"` WebPreview bool `bson:"webpreview,omitempty" json:"webpreview,omitempty"` IsProtected bool `bson:"is_protected,omitempty" json:"is_protected,omitempty"` NoNotif bool `bson:"no_notif,omitempty" json:"no_notif,omitempty"` Buttons []Button `bson:"note_buttons,omitempty" json:"note_buttons,omitempty"` }
type ChatReportSettings ¶
type ChatReportSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Status bool `bson:"status,omitempty" json:"status,omitempty"` BlockedList []int64 `bson:"blocked_list,omitempty" json:"blocked_list,omitempty"` }
func GetChatReportSettings ¶
func GetChatReportSettings(chatID int64) (reportsrc *ChatReportSettings)
type ConnectionSettings ¶
type ConnectionSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` AllowConnect bool `bson:"can_connect" json:"can_connect" default:"false"` }
func GetChatConnectionSetting ¶
func GetChatConnectionSetting(chatID int64) (connectionSrc *ConnectionSettings)
type Connections ¶
type Connections struct { UserId int64 `bson:"_id,omitempty" json:"_id,omitempty"` ChatId int64 `bson:"chat_id,omitempty" json:"chat_id,omitempty"` Connected bool `bson:"connected" json:"connected" default:"false"` }
func Connection ¶
func Connection(UserID int64) *Connections
type DisableCommand ¶
type FloodSettings ¶
type FloodSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Limit int `bson:"limit" json:"limit"` Mode string `bson:"mode,omitempty" json:"mode,omitempty"` DeleteAntifloodMessage bool `bson:"del_msg" json:"del_msg"` }
FloodSettings Flood Settings struct for chat
type GoodbyeSettings ¶
type GoodbyeSettings struct { CleanGoodbye bool `bson:"clean_old" json:"clean_old" default:"false"` LastMsgId int64 `bson:"last_msg_id,omitempty" json:"last_msg_id,omitempty"` ShouldGoodbye bool `bson:"enabled" json:"enabled" default:"true"` GoodbyeText string `bson:"text,omitempty" json:"text,omitempty"` FileID string `bson:"file_id,omitempty" json:"file_id,omitempty"` GoodbyeType int `bson:"type,omitempty" json:"type,omitempty"` Button []Button `bson:"btns,omitempty" json:"btns,omitempty"` }
type GreetingSettings ¶
type GreetingSettings struct { ChatID int64 `bson:"_id,omitempty" json:"_id,omitempty"` ShouldCleanService bool `bson:"clean_service_settings" json:"clean_service_settings" default:"false"` WelcomeSettings *WelcomeSettings `bson:"welcome_settings" json:"welcome_settings" default:"false"` GoodbyeSettings *GoodbyeSettings `bson:"goodbye_settings" json:"goodbye_settings" default:"false"` ShouldAutoApprove bool `bson:"auto_approve" json:"auto_approve" default:"false"` }
func GetGreetingSettings ¶
func GetGreetingSettings(chatID int64) *GreetingSettings
type Locks ¶
type Locks struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Permissions *Permissions `bson:"permissions,omitempty" json:"permissions,omitempty"` Restrictions *Restrictions `bson:"restrictions,omitempty" json:"restrictions,omitempty"` }
func GetChatLocks ¶
type NoteSettings ¶
type NoteSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` PrivateNotesEnabled bool `bson:"private_notes" json:"private_notes" default:"false"` }
func GetNotes ¶
func GetNotes(chatID int64) *NoteSettings
type Permissions ¶
type Permissions struct { Sticker bool `bson:"sticker,omitempty" json:"sticker,omitempty"` Audio bool `bson:"audio,omitempty" json:"audio,omitempty"` Voice bool `bson:"voice,omitempty" json:"voice,omitempty"` Video bool `bson:"video,omitempty" json:"video,omitempty"` Document bool `bson:"document,omitempty" json:"document,omitempty"` VideoNote bool `bson:"video_note,omitempty" json:"video_note,omitempty"` Contact bool `bson:"contact,omitempty" json:"contact,omitempty"` Photo bool `bson:"photo,omitempty" json:"photo,omitempty"` Gif bool `bson:"gif,omitempty" json:"gif,omitempty"` Url bool `bson:"url,omitempty" json:"url,omitempty"` Bot bool `bson:"bot,omitempty" json:"bot,omitempty"` Forward bool `bson:"forward,omitempty" json:"forward,omitempty"` Game bool `bson:"game,omitempty" json:"game,omitempty"` Location bool `bson:"location,omitempty" json:"location,omitempty"` Arab bool `bson:"arab_chars,omitempty" json:"arab_chars,omitempty"` SendAsChannel bool `bson:"send_as_channel,omitempty" json:"send_as_channel,omitempty"` }
type Pins ¶
type Pins struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` AntiChannelPin bool `bson:"antichannelpin" json:"antichannelpin" default:"false"` CleanLinked bool `bson:"cleanlinked" json:"cleanlinked" default:"false"` }
func GetPinData ¶
type Restrictions ¶
type Restrictions struct { Messages bool `bson:"messages,omitempty" json:"messages,omitempty"` ChannelComments bool `bson:"channel_comments,omitempty" json:"channel_comments,omitempty"` Media bool `bson:"media,omitempty" json:"media,omitempty"` Other bool `bson:"other,omitempty" json:"other,omitempty"` Previews bool `bson:"previews,omitempty" json:"previews,omitempty"` All bool `bson:"all,omitempty" json:"all,omitempty"` }
type Rules ¶
type Rules struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Rules string `bson:"rules" json:"rules" default:""` Private bool `bson:"privrules" json:"privrules"` RulesBtn string `bson:"rules_button,omitempty" json:"rules_button,omitempty"` }
func GetChatRulesInfo ¶
type Team ¶
type Team struct { UserId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Dev bool `bson:"dev" json:"dev" default:"false"` Sudo bool `bson:"sudo" json:"sudo" default:"false"` }
func GetTeamMemInfo ¶
type UserReportSettings ¶
type UserReportSettings struct { UserId int64 `bson:"_id,omitempty" json:"_id,omitempty"` Status bool `bson:"status,omitempty" json:"status,omitempty"` }
func GetUserReportSettings ¶
func GetUserReportSettings(userId int64) (reportsrc *UserReportSettings)
type WarnSettings ¶
type WarnSettings struct { ChatId int64 `bson:"_id,omitempty" json:"_id,omitempty"` WarnLimit int `bson:"warn_limit" json:"warn_limit" default:"3"` WarnMode string `bson:"warn_mode,omitempty" json:"warn_mode,omitempty"` }
func GetWarnSetting ¶
func GetWarnSetting(chatId int64) *WarnSettings
type WelcomeSettings ¶
type WelcomeSettings struct { CleanWelcome bool `bson:"clean_old" json:"clean_old" default:"false"` LastMsgId int64 `bson:"last_msg_id,omitempty" json:"last_msg_id,omitempty"` ShouldWelcome bool `bson:"enabled" json:"welcome_enabled" default:"true"` WelcomeText string `bson:"text,omitempty" json:"welcome_text,omitempty"` FileID string `bson:"file_id,omitempty" json:"file_id,omitempty"` WelcomeType int `bson:"type,omitempty" json:"welcome_type,omitempty"` Button []Button `bson:"btns,omitempty" json:"btns,omitempty"` }
Click to show internal directories.
Click to hide internal directories.