class

PrivateParlorXT::UpvoteHandler

Inherits PrivateParlorXT::HearsHandler < PrivateParlorXT::Handler < Reference < Object

A command-like HearsHandler used for upvote messages sent by other users.

Instance methods

authorized?(user : User, message : Tourmaline::Message, authority : CommandPermissions, services : Services) : Bool

Checks if the user is authorized to upvote a message

Returns true if so, false otherwise

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

Upvotes the message that the given message replies to if it meets requirements

Source
karma_level_up(reply_user : User, reply_parameters : ReplyParameters | Nil, services : Services) : Nil

Checks if the user has gained a karma level when karma levels are set, and if so, queues a 'leveled up' response

Source
record_message_statistics(services : Services) : Nil

Records message statistics about upvotes if the Statistics module is enabled

Source
send_replies(user : User, reply_user : User, message : Tourmaline::Message, reply : Tourmaline::Message, services : Services) : Nil

Queues 'gave upvote' and 'got upvoted' replies for the user and reply_user, respectively

Includes a reason for the upvote if karma reasons are enabled.

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

Checks if the user is spamming upvotes

Returns true if the user is spamming upvotes, false otherwise

Source
upvote_message(user : User, reply_user : User, message : Tourmaline::Message, reply : Tourmaline::Message, services : Services) : Bool

Adds user's upvote to message history and update reply_user's karma Returns false if user has already upvoted the message or user attempted to give himself karma

Source
user_from_message(message : Tourmaline::Message, services : Services) : User | Nil

Returns the User associated with the message if the User could be found in the Database. This will also update the User's username and realname if they have changed since the last message.

Returns nil if:

  • Message has no sender
  • User does not exist in the Database
  • User cannot use a command due to being blacklisted
Source