class PrivateParlorXT::RegularForwardHandler
- PrivateParlorXT::RegularForwardHandler
- PrivateParlorXT::UpdateHandler
- PrivateParlorXT::Handler
- Reference
- Object
Overview
An alternative to the ForwardHandler which handles forwarded messages, but
appends a "Forwarded from" header to the text/caption of the message and relays
the message as though it were being relayed by the TextHandler, AlbumHandler, PhotoHandler
or a similar UpdateHandler with respect to the forwarded message's media type
Included Modules
Defined in:
private-parlor-xt/handlers/update_handlers/regular_forward_handler.crInstance Method Summary
-
#albums : Hash(String, Album)
A hash of
String, media group IDs, toAlbum, representing forwarded albums -
#albums=(albums : Hash(String, Album))
A hash of
String, media group IDs, toAlbum, representing forwarded albums -
#deanonymous_poll?(user : User, message : Tourmaline::Message, services : Services) : Bool
Returns
trueif the forwarded poll does not have anonymous voting -
#do(message : Tourmaline::Message, services : Services) : Nil
Checks if the forwarded message meets requirements and relays it
-
#forward_header(message : Tourmaline::Message, entities : Array(Tourmaline::MessageEntity)) : Tuple(String | Nil, Array(Tourmaline::MessageEntity))
Returns a 'Forwarded from' header according to the original user which the message came from
-
#get_header(message : Tourmaline::Message, entities : Array(Tourmaline::MessageEntity)) : Tuple(String | Nil, Array(Tourmaline::MessageEntity))
Returns the forwarded fromheader and its entities from the given message and entities
-
#private_channel_forward(name : String, id : Int64 | Int32, entities : Array(Tourmaline::MessageEntity), msid : Int64 | Int32 | Nil = nil) : Tuple(String, Array(Tourmaline::MessageEntity))
Returns a 'Forwarded from' header for private channels, removing the "-100" prefix for private channel IDs
-
#private_user_forward(name : String, entities : Array(Tourmaline::MessageEntity)) : Tuple(String, Array(Tourmaline::MessageEntity))
Returns a 'Forwarded from' header for private users
-
#regular_forward?(text : String | Nil, entities : Array(Tourmaline::MessageEntity)) : Bool | Nil
Checks the text and entities for a forwarded message to determine if it was relayed as a regular message
-
#relay_regular_forward(message : Tourmaline::Message, text : String, entities : Array(Tourmaline::MessageEntity), cached_message : MessageID, user : User, receivers : Array(UserID), services : Services) : Nil
Relays the forwarded message as though it were a text message, album, photo, or similar media type
-
#spamming?(user : User, message : Tourmaline::Message, services : Services) : Bool
Checks if the user is spamming forwarded messages
-
#spend_karma(user : User, message : Tourmaline::Message, services : Services) : User
Returns the
Userwith decremented karma whenKarmaHandleris enabled and user has sufficient karma for a forwarded message -
#sufficient_karma?(user : User, message : Tourmaline::Message, services : Services) : Bool | Nil
Checks if the user has sufficient karma to send a forwarded message when
KarmaHandleris enabled -
#user_forward(name : String, id : Int64 | Int32, entities : Array(Tourmaline::MessageEntity)) : Tuple(String, Array(Tourmaline::MessageEntity))
Returns a 'Forwarded from' header for users who do not have forward privacy enabled
-
#username_forward(name : String, username : String | Nil, entities : Array(Tourmaline::MessageEntity), msid : Int64 | Int32 | Nil = nil) : Tuple(String, Array(Tourmaline::MessageEntity))
Returns a 'Forwarded from' header for bots and public channels
Instance methods inherited from module PrivateParlorXT::AlbumHelpers
album_input(message : Tourmaline::Message, caption : String, entities : Array(Tourmaline::MessageEntity), allow_spoilers : Bool | Nil = false) : AlbumMedia | Nil
album_input,
relay_album(albums : Hash(String, Album), album : String, message_id : MessageID, input : AlbumMedia, user : User, receivers : Array(UserID), reply_msids : Hash(UserID, ReplyParameters), effect : String | Nil, services : Services) : Nil
relay_album
Instance methods inherited from class PrivateParlorXT::UpdateHandler
authorized?(user : User, message : Tourmaline::Message, authority : MessagePermissions, services : Services) : Bool
authorized?,
deny_user(user : User, services : Services) : Nil
deny_user,
meets_requirements?(message : Tourmaline::Message) : Bool
meets_requirements?,
message_receivers(user : User, services : Services) : Array(UserID)
message_receivers,
record_message_statistics(type : Statistics::Messages, services : Services) : Nil
record_message_statistics,
reply_receivers(message : Tourmaline::Message, user : User, services : Services) : Hash(UserID, ReplyParameters) | Nil
reply_receivers,
user_from_message(message : Tourmaline::Message, services : Services) : User | Nil
user_from_message
Macros inherited from class PrivateParlorXT::UpdateHandler
return_on_command(text)
return_on_command
Instance methods inherited from class PrivateParlorXT::Handler
do(message : Tourmaline::Message, services : Services) : Nil
do,
reply_message(user : User, message : Tourmaline::Message, services : Services) : Tourmaline::Message | Nil
reply_message,
reply_user(user : User, reply_message : Tourmaline::Message, services : Services) : User | Nil
reply_user,
unique?(user : User, message : Tourmaline::Message, services : Services, text : String | Nil = nil) : Bool
unique?,
update_user_activity(user : User, services : Services) : Nil
update_user_activity
Constructor methods inherited from class PrivateParlorXT::Handler
new(config : Config)
new
Instance Method Detail
A hash of String, media group IDs, to Album, representing forwarded albums
A hash of String, media group IDs, to Album, representing forwarded albums
Returns true if the forwarded poll does not have anonymous voting
Returns false otherwise
Checks if the forwarded message meets requirements and relays it
Returns a 'Forwarded from' header according to the original user which the message came from
Returns the forwarded fromheader and its entities from the given message and entities
Returns a 'Forwarded from' header for private channels, removing the "-100" prefix for private channel IDs
Returns a 'Forwarded from' header for private users
Checks the text and entities for a forwarded message to determine if it was relayed as a regular message
Returns true if the forward message was relayed regularly, nil otherwise
Relays the forwarded message as though it were a text message, album, photo, or similar media type
Checks if the user is spamming forwarded messages
Returns true if the user is spamming forwarded messages, false otherwise
Returns the User with decremented karma when KarmaHandler is enabled and
user has sufficient karma for a forwarded message
Checks if the user has sufficient karma to send a forwarded message when KarmaHandler is enabled
Returns true if:
KarmaHandleris not enabled- The price for forwarded messages is less than 0
- The user's
Rankis equal to or greater than the cutoffRank - User has sufficient karma
Returns nil if the user does not have sufficient karma
Returns a 'Forwarded from' header for users who do not have forward privacy enabled
Returns a 'Forwarded from' header for bots and public channels