Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChecksToString ¶ added in v1.15.0
ChecksToString converts a slice of checks to a string
Types ¶
type LastRequests ¶ added in v1.16.0
type LastRequests struct {
// contains filtered or unexported fields
}
LastRequests keeps track of last N requests, thread-safe.
func NewLastRequests ¶ added in v1.16.0
func NewLastRequests(size int) *LastRequests
NewLastRequests creates new requests tracker
func (*LastRequests) Last ¶ added in v1.16.0
func (h *LastRequests) Last(n int) []Request
Last returns up to n last requests in chronological order (oldest to newest)
func (*LastRequests) Push ¶ added in v1.16.0
func (h *LastRequests) Push(req Request)
Push adds new request to the history
func (*LastRequests) Size ¶ added in v1.16.0
func (h *LastRequests) Size() int
Size returns the size of request history
type MetaData ¶ added in v1.9.0
type MetaData struct {
Images int `json:"images"` // number of images in the message
Links int `json:"links"` // number of links in the message
Mentions int `json:"mentions"` // number of mentions (@username) in the message
HasVideo bool `json:"has_video"` // true if the message has a video or video note
HasAudio bool `json:"has_audio"` // true if the message has an audio
HasForward bool `json:"has_forward"` // true if the message has a forward
HasKeyboard bool `json:"has_keyboard"` // true if the message has a keyboard (buttons)
HasContact bool `json:"has_contact"` // true if the message has a shared contact
HasGiveaway bool `json:"has_giveaway"` // true if the message is a giveaway
MessageID int `json:"message_id"` // telegram message ID
}
MetaData is a meta-info about the message, provided by the client.
type Request ¶
type Request struct {
Msg string `json:"msg"` // message to check
UserID string `json:"user_id"` // user id
UserName string `json:"user_name"` // user name
Meta MetaData `json:"meta"` // meta-info, provided by the client
CheckOnly bool `json:"check_only"` // if true, only check the message, do not write newly approved user to the database
}
Request is a request to check a message for spam.
type Response ¶
type Response struct {
Name string `json:"name"` // name of the check
Spam bool `json:"spam"` // true if spam
Details string `json:"details"` // details of the check
Error error `json:"-"` // error message, if any. Do not serialize it
ExtraDeleteIDs []int `json:"extra_delete_ids,omitempty"` // additional message IDs to delete when spam detected
}
Response is a result of spam check.
Click to show internal directories.
Click to hide internal directories.