Documentation ¶
Index ¶
- func AnswerCallback(upd tgbotapi.Update, bot *tgbotapi.BotAPI, text string)
- func BanUser(TgID int, bot *tgbotapi.BotAPI) error
- func CallbackInfo(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func CheckNewUsers(bot *tgbotapi.BotAPI)
- func ConfirmBan(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func DisplayAliases(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func DisplayWarnings(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func FindUserByUserID(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func FindUserByUsername(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func GetBotStatus(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func GetMemberFromID(bot *tgbotapi.BotAPI, userID int) (tgbotapi.ChatMember, error)
- func GetUserInfoResponse(user *models.ChatUser) tgbotapi.MessageConfig
- func HandleUsers(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func InitBot(botToken string)
- func InitiateUser(upd tgbotapi.Update, bot *tgbotapi.BotAPI, newUser tgbotapi.User)
- func LogBotAction(bot *tgbotapi.BotAPI, botAction BotAction)
- func LogCallback(upd tgbotapi.Update, callback tgbotapi.CallbackConfig)
- func LogCommand(upd tgbotapi.Update, err error)
- func LogMessage(upd tgbotapi.Update)
- func LookupAlias(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func MainChatHelp(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func MakeAliasInlineKeyboard(aliases []models.ChatUser) tgbotapi.InlineKeyboardMarkup
- func MakeBanConfirmInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
- func MakeBanInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
- func MakeCaptchaInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
- func MakeInitiateUserInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
- func MakeReturnToChatInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
- func MakeUserInfoInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
- func MakeUserInfoInlineKeyboardRefreshAliasButton(userID int64, curAliasPage int64, aliasPagesTotal int64) tgbotapi.InlineKeyboardMarkup
- func MakeUserInfoInlineKeyboardRefreshWarnButton(userID int64) tgbotapi.InlineKeyboardMarkup
- func ModChatHelp(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func PreBan(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func PreConfirmBan(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func PrivateChatHelp(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func ProcessCallback(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func ProcessMessage(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func Register(regexIn string, chanIn int64, ...)
- func RegisterCallback(regexIn string, handleFunc func(tgbotapi.Update, *tgbotapi.BotAPI))
- func ResolveAlert(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func Start(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func SummonMods(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func TestCmd(updateIn tgbotapi.Update, botIn *tgbotapi.BotAPI)
- func ToggleMods(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func VerifyCorrect(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func VerifyIncorrect(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func WarnUserByID(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- func WarnUserByUsername(upd tgbotapi.Update, bot *tgbotapi.BotAPI)
- type BotAction
- type BotActionType
- type BotCommand
- type NewUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnswerCallback ¶
AnswerCallback answers the callback query made in the provided update. Note: If text is not an empty string, it will be displayed to the user who initiated the callback query.
func BanUser ¶
BanUser is a helper function to ban a user in the main chat based on their Telegram ID
func CallbackInfo ¶
CallbackInfo is a callback handler to update a find by alias request after a user button is clicked
func CheckNewUsers ¶
CheckNewUsers checks to see if any recently joined members have been in the chat for too long
func ConfirmBan ¶
ConfirmBan handles the callback when the user presses the final ban confirmation button
func DisplayAliases ¶
DisplayAliases is a callback handler to update a get user info response to add all known user aliases
func DisplayWarnings ¶
DisplayWarnings is a callback handler to update a get user info response to add warnings for the user
func FindUserByUserID ¶
FindUserByUserID gets user information by telegram ID
func FindUserByUsername ¶
FindUserByUsername finds user information by username
func GetBotStatus ¶
GetBotStatus returns uptime of the bot
func GetMemberFromID ¶
GetMemberFromID gets information about a user from their telegram ID
func GetUserInfoResponse ¶
func GetUserInfoResponse(user *models.ChatUser) tgbotapi.MessageConfig
GetUserInfoResponse is a helper method to generate the response object for the info requests
func HandleUsers ¶
HandleUsers reads non-command messages to record user information/changes
func InitBot ¶
func InitBot(botToken string)
InitBot starts up the bot and processes incoming updates
func InitiateUser ¶
InitiateUser checks to see if a user is a real person or not by making them talk to the bot
func LogBotAction ¶
LogBotAction sends a message to the bot logs channel
func LogCallback ¶
func LogCallback(upd tgbotapi.Update, callback tgbotapi.CallbackConfig)
LogCallback logs information from a processed callback
func LogCommand ¶
LogCommand logs information from a processed command
func LogMessage ¶
LogMessage logs information from a processed message
func LookupAlias ¶
LookupAlias finds a user even if only part of one of their aliases is provided
func MainChatHelp ¶
MainChatHelp lists commands available in the main chat
func MakeAliasInlineKeyboard ¶
func MakeAliasInlineKeyboard(aliases []models.ChatUser) tgbotapi.InlineKeyboardMarkup
MakeAliasInlineKeyboard is a helper method to generate the buttons for the lookup by alias command
func MakeBanConfirmInlineKeyboard ¶
func MakeBanConfirmInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
MakeBanConfirmInlineKeyboard is a helper method to generate the buttons for the final ban request
func MakeBanInlineKeyboard ¶
func MakeBanInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
MakeBanInlineKeyboard is a helper method to generate the buttons for a pre ban request
func MakeCaptchaInlineKeyboard ¶
func MakeCaptchaInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
MakeCaptchaInlineKeyboard is a helper method for solving captchas
func MakeInitiateUserInlineKeyboard ¶
func MakeInitiateUserInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
MakeInitiateUserInlineKeyboard is a helper method to generate the buttons for a user initiation
func MakeReturnToChatInlineKeyboard ¶
func MakeReturnToChatInlineKeyboard(userID int) tgbotapi.InlineKeyboardMarkup
MakeReturnToChatInlineKeyboard is a helper method to generate the button to go back to @rfurry
func MakeUserInfoInlineKeyboard ¶
func MakeUserInfoInlineKeyboard(userID int64) tgbotapi.InlineKeyboardMarkup
MakeUserInfoInlineKeyboard is a helper method to generate the buttons for an initial info request
func MakeUserInfoInlineKeyboardRefreshAliasButton ¶
func MakeUserInfoInlineKeyboardRefreshAliasButton(userID int64, curAliasPage int64, aliasPagesTotal int64) tgbotapi.InlineKeyboardMarkup
MakeUserInfoInlineKeyboardRefreshAliasButton is a helper method to generate the buttons for an info request after view aliases button is pressed
func MakeUserInfoInlineKeyboardRefreshWarnButton ¶
func MakeUserInfoInlineKeyboardRefreshWarnButton(userID int64) tgbotapi.InlineKeyboardMarkup
MakeUserInfoInlineKeyboardRefreshWarnButton is a helper method to generate the buttons for an info request after view warnings button is pressed
func ModChatHelp ¶
ModChatHelp lists commands available in the mod chat
func PreConfirmBan ¶
PreConfirmBan handles the callback when a user presses the first confirm ban button
func PrivateChatHelp ¶
PrivateChatHelp lists commands available in private chats
func ProcessCallback ¶
ProcessCallback checks the list of recognized callbacks to see if any are found
func ProcessMessage ¶
ProcessMessage logs the message and checks the list of recognized commands to see if any are found
func RegisterCallback ¶
RegisterCallback adds a regex pattern to the list of recognized callbacks
func ResolveAlert ¶
ResolveAlert deletes messages which were created during the /mods command
func Start ¶
Start is a command used when the bot is first run If the user is being verified, it will act differently
func SummonMods ¶
SummonMods summons moderators to a chat
func ToggleMods ¶
ToggleMods handles toggling of a user's ability to use /mods
func VerifyCorrect ¶
VerifyCorrect verifies a user who solves the captcha
func VerifyIncorrect ¶
VerifyIncorrect resets the captcha when a user picks the wrong answer
func WarnUserByID ¶
WarnUserByID warns a user by telegram ID
Types ¶
type BotAction ¶
type BotAction struct { Type BotActionType InvokerUserID int ReceiverUserID int }
BotAction represents an action taken by the bot
type BotActionType ¶
type BotActionType string
BotActionType indicates the type of action the bot is taking
const ( // BotActionBan removes a user BotActionBan BotActionType = "BAN" //BotActionVerify verifies a user BotActionVerify BotActionType = "VERIFY" //BotActionRemovePermissions removes all permissions from a user BotActionRemovePermissions BotActionType = "REMOVEPERMISSIONS" )