class

PrivateParlorXT::DocumentHandler

Inherits PrivateParlorXT::UpdateHandler < PrivateParlorXT::Handler < Reference < Object

A handler for files and document message updates

Instance methods

do(message : Tourmaline::Message, services : Services) : Nil

Checks if the document message meets requirements and relays it

Source
meets_requirements?(message : Tourmaline::Message) : Bool

Returns true if the message meets requirements

Returns `false if the message does not meet requirements, when the message is a forward, part of an album, or an animation/GIF

Source
spamming?(user : User, message : Tourmaline::Message, services : Services) : Bool

Checks if the user is spamming documents

Returns true if the user is spamming documents, false otherwise

Source
spend_karma(user : User, services : Services) : User

Returns the User with decremented karma when KarmaHandler is enabled and user has sufficient karma for a document

Source
sufficient_karma?(user : User, message : Tourmaline::Message, services : Services) : Bool | Nil

Checks if the user has sufficient karma to send a document when KarmaHandler is enabled

Returns true if:

  • KarmaHandler is not enabled
  • The price for documents is less than 0
  • The user's Rank is equal to or greater than the cutoff Rank
  • User has sufficient karma

Returns nil if the user does not have sufficient karma

Source