Documentation ¶
Index ¶
- Constants
- Variables
- func AddNoteToDb(chatId string, noteName string, noteData string, msgtype int, buttons []Button, ...)
- func AddToBlacklist(chatID string, trigger string)
- func AddWarnFilter(chatId string, keyword string, reply string)
- func AllChats() []string
- func AllFedChats(fedId string) []string
- func CacheBlacklist(chatID string)
- func ChatJoinFed(fedId string, chatId string) bool
- func ChatLeaveFed(chatId string) bool
- func DelFed(fedId string)
- func DoesChatGban(chatId string) bool
- func EnsureBotInDb(u *gotgbot.Updater)
- func FbanUser(fedId string, userId string, reason string)
- func GbanUser(userId string, reason string)
- func GetCleanWelcome(chatID string) int
- func GetDelPref(chatID string) bool
- func GetFbanUsersCount(fedId string) int
- func GetFedId(chatId string) string
- func GetWarnSetting(chatId string) (int, bool)
- func GetWarns(userId string, chatId string) (int, []string)
- func HasUserClickedButton(userID, chatID string) bool
- func IsUserFedAdmin(fedId string, userId string) string
- func IsUserFedOwner(userId string, fedId string) bool
- func IsUserHuman(userID, chatID string) bool
- func NewFed(ownerId string, fedId string, fedName string) bool
- func RemoveWarn(userId string, chatId string) bool
- func RemoveWarnFilter(chatId string, keyword string) bool
- func ResetWarns(userId string, chatId string)
- func RmFromBlacklist(chatID string, trigger string) bool
- func RmNote(chatId string, noteName string) bool
- func SetChatRules(chatId, rules string)
- func SetCleanWelcome(chatID string, cw int)
- func SetCustomWelcome(chatID string, welcome string, buttons []WelcomeButton, welcType int)
- func SetDelPref(chatID string, pref bool)
- func SetGBanPref(chatID string, pref bool)
- func SetMutePref(chatID string, pref bool)
- func SetWarnLimit(chatId string, warnLimit int)
- func SetWarnStrength(chatId string, softWarn bool)
- func SetWelcPref(chatID string, pref bool)
- func UnFbanUser(fedId string, userId string)
- func UnGbanUser(userId string)
- func UpdateUser(userId int, username string, chatId string, chatName string)
- func UserClickedButton(userID, chatID string)
- func UserDemoteFed(fedId string, userId string)
- func UserPromoteFed(fedId string, userId string)
- func WarnUser(userId string, chatId string, reason string) (int, []string)
- type BlackListFilters
- type Button
- type Chat
- type FedAdmin
- type FedBan
- type FedChat
- type Federation
- type GlobalBan
- type GlobalBanSetting
- type MutedUser
- type Note
- type Rules
- type User
- type WarnFilters
- type WarnSettings
- type Warns
- type Welcome
- type WelcomeButton
Constants ¶
View Source
const ( TEXT = 0 BUTTON_TEXT = 1 STICKER = 2 DOCUMENT = 3 PHOTO = 4 AUDIO = 5 VOICE = 6 VIDEO = 7 )
View Source
const DefaultWelcome = "Hey {first}, how are you?"
Variables ¶
View Source
var SESSION *gorm.DB
Functions ¶
func AddNoteToDb ¶
func AddToBlacklist ¶
func AddWarnFilter ¶
func AllFedChats ¶
func CacheBlacklist ¶
func CacheBlacklist(chatID string)
func ChatJoinFed ¶
func ChatLeaveFed ¶
func DoesChatGban ¶
func EnsureBotInDb ¶
func GetCleanWelcome ¶
GetCleanWelcome Get whether to clean old welcome messages or not
func GetDelPref ¶
GetDelPref Get Whether to delete service messages or not
func GetFbanUsersCount ¶
func GetWarnSetting ¶
func HasUserClickedButton ¶
HasUserClickedButton Has the user clicked button to unmute themselves
func IsUserFedAdmin ¶
func IsUserFedOwner ¶
func RemoveWarn ¶
func RemoveWarnFilter ¶
func ResetWarns ¶
func RmFromBlacklist ¶
func SetChatRules ¶
func SetChatRules(chatId, rules string)
func SetCleanWelcome ¶
SetCleanWelcome Set whether to clean old welcome messages or not
func SetCustomWelcome ¶
func SetCustomWelcome(chatID string, welcome string, buttons []WelcomeButton, welcType int)
SetCustomWelcome Set the custom welcome string
func SetDelPref ¶
SetDelPref Set whether to delete service messages or not
func SetGBanPref ¶
func SetMutePref ¶
SetMutePref Set whether to mute users when they join or not
func SetWarnLimit ¶
func SetWarnStrength ¶
func SetWelcPref ¶
func UnFbanUser ¶
func UnGbanUser ¶
func UnGbanUser(userId string)
func UserClickedButton ¶
func UserClickedButton(userID, chatID string)
UserClickedButton Mark the user as a human
func UserDemoteFed ¶
func UserPromoteFed ¶
Types ¶
type BlackListFilters ¶
type BlackListFilters struct { ChatID string `gorm:"primary_key" json:"chat_id"` Trigger string `gorm:"primary_key" json:"trigger"` }
func GetChatBlacklist ¶
func GetChatBlacklist(chatID string) []BlackListFilters
type Button ¶
type Button struct { Id uint `gorm:"primary_key;AUTO_INCREMENT" json:"id"` ChatId string `gorm:"primary_key" json:"chat_id"` NoteName string `gorm:"primary_key" json:"note_name"` Name string `gorm:"not null" json:"name"` Url string `gorm:"not null" json:"url"` SameLine bool `gorm:"default:false" json:"same_line"` }
func GetButtons ¶
type FedAdmin ¶
func GetAllFedsAdminsGlobal ¶
func GetAllFedsAdminsGlobal() []FedAdmin
func GetFedAdmins ¶
type FedBan ¶
type FedBan struct { FedRef string `gorm:"primary_key" json:"fed_ref"` UserId string `gorm:"primary_key" json:"user_id"` Reason string `json:"reason"` }
func GetAllFbanUsersGlobal ¶
func GetAllFbanUsersGlobal() []FedBan
func GetFbanUser ¶
type Federation ¶
type Federation struct { Id string `gorm:"primary_key"` OwnerId string FedName string FedAdmins []FedAdmin `gorm:"foreignkey:Id"` //FedChats []FedChat `gorm:"foreignkey:Id"` FedBans []FedBan `gorm:"foreignkey:FedRef"` }
func GetChatFed ¶
func GetChatFed(chatId string) *Federation
func GetFedFromOwnerId ¶
func GetFedFromOwnerId(ownerId string) *Federation
func GetFedInfo ¶
func GetFedInfo(fedId string) *Federation
func GetUserFbans ¶
func GetUserFbans(userId string) []Federation
type GlobalBan ¶
func GetGbanUser ¶
type GlobalBanSetting ¶
type Note ¶
type Note struct { ChatId string `gorm:"primary_key" json:"chat_id"` Name string `gorm:"primary_key" json:"name"` Value string `gorm:"not null" json:"value"` File string `json:"file"` IsReply bool `gorm:"default:false" json:"is_reply"` HasButtons bool `gorm:"default:false" json:"has_buttons"` Msgtype int `gorm:"default:1" json:"msgtype"` }
func GetAllChatNotes ¶
type Rules ¶
func GetChatRules ¶
type User ¶
type User struct { UserId int `gorm:"primary_key" json:"user_id"` UserName string `json:"user_name"` }
func GetUserIdByName ¶
type WarnFilters ¶
type WarnFilters struct { ChatId string `gorm:"primary_key"` Keyword string `gorm:"primary_key"` Reply string `gorm:"not null"` }
func GetChatWarnTriggers ¶
func GetChatWarnTriggers(chatId string) []WarnFilters
func GetWarnFilter ¶
func GetWarnFilter(chatId string, keyword string) *WarnFilters
func (WarnFilters) String ¶
func (wf WarnFilters) String() string
type WarnSettings ¶
type Warns ¶
type Warns struct { UserId string `gorm:"primary_key"` ChatId string `gorm:"primary_key"` NumWarns int `gorm:"default:0"` Reasons pq.StringArray `gorm:"type:varchar(64)[]"` }
type Welcome ¶
type Welcome struct { ChatId string `gorm:"primary_key"` CustomWelcome string ShouldWelcome bool `gorm:"default:true"` ShouldMute bool `gorm:"default:true"` DelJoined bool `gorm:"default:false"` CleanWelcome int `gorm:"default:0"` WelcomeType int `gorm:"default:0"` MuteTime int `gorm:"default:0"` }
func GetWelcomePrefs ¶
GetWelcomePrefs Return the preferences for welcoming users
type WelcomeButton ¶
type WelcomeButton struct { Id uint `gorm:"primary_key;AUTO_INCREMENT"` ChatId string `gorm:"primary_key"` Name string `gorm:"not null"` Url string `gorm:"not null"` SameLine bool `gorm:"default:false"` }
func GetWelcomeButtons ¶
func GetWelcomeButtons(chatID string) []WelcomeButton
GetWelcomeButtons Get the buttons for the welcome message
Click to show internal directories.
Click to hide internal directories.