class PrivateParlorXT::SQLiteUser
- PrivateParlorXT::SQLiteUser
- PrivateParlorXT::User
- Reference
- Object
Overview
An implementation of User
for the the SQLiteDatabase
Included Modules
- DB::Mappable
Defined in:
private-parlor-xt/database/SQLite/sqlite_user.crConstructors
- .new(__temp_87 : DB::ResultSet)
-
.new(id : Int64, username : String | Nil = nil, realname : String = "", rank : Int32 = 0, joined : Time = Time.utc, left : Time | Nil = nil, last_active : Time = Time.utc, cooldown_until : Time | Nil = nil, blacklist_reason : String | Nil = nil, warnings : Int32 = 0, warn_expiry : Time | Nil = nil, karma : Int32 = 0, hide_karma : Bool | Nil = false, debug_enabled : Bool | Nil = false, tripcode : String | Nil = nil)
Creates an instance of
SQLiteUser
.
Class Method Summary
Instance Method Summary
-
#blacklist_reason : String?
Returns the reason why the user was blacklisted, or
nil
if a reason does not exist - #blacklist_reason=(_blacklist_reason : Union(String, Nil) | Nil)
-
#cooldown_until : Time?
Returns the
Time
until which the user is in cooldown, ornil
if the user is not cooldowned - #cooldown_until=(_cooldown_until : Union(Time, Nil) | Nil)
-
#debug_enabled : Bool?
Returns true if the suer has debug mode enabled,
false
otherwise - #debug_enabled=(_debug_enabled : Union(Bool, Nil) | Nil)
-
#hide_karma : Bool?
Returns true if the user has karma notifications disabled,
false
otherwise - #hide_karma=(_hide_karma : Union(Bool, Nil) | Nil)
-
#id : Int64
Returns the user's ID
- #id=(_id : UserID)
-
#joined : Time
Returns the
Time
the user joined the chat - #joined=(_joined : Time)
-
#karma : Int32
Returns the user's current amount of karma
- #karma=(_karma : Int32)
-
#last_active : Time
Returns the
Time
the user was last active (i.e., the last time a message was sent or a command was used) - #last_active=(_last_active : Time)
-
#left : Time?
Returns the
Time
the user left the chat, ornil
if the user has not left - #left=(_left : Union(Time, Nil) | Nil)
-
#rank : Int32
Returns the user's current rank value
- #rank=(_rank : Int32)
-
#realname : String
Returns the user's full name
- #realname=(_realname : String)
-
#tripcode : String?
Returns a
String
containing the user's tripcode name and password for generating tripcodes, ornil
if the user has no tripcode set - #tripcode=(_tripcode : Union(String, Nil) | Nil)
-
#username : String?
Returns the user's unformatted username, or
nil
if it does not exist - #username=(_username : Union(String, Nil) | Nil)
-
#warn_expiry : Time?
Returns the
Time
when one of the#warnings
will expire, ornil
if such a time does not exit - #warn_expiry=(_warn_expiry : Union(Time, Nil) | Nil)
-
#warnings : Int32
Returns the number of warnings the user has
- #warnings=(_warnings : Int32)
Instance methods inherited from class PrivateParlorXT::User
blacklist(reason : String | Nil) : Nil
blacklist,
blacklist_reason : String | Nil
blacklist_reason,
blacklisted? : Bool
blacklisted?,
can_chat?(limit : Time::Span) : Boolcan_chat? : Bool can_chat?, can_use_command? : Bool can_use_command?, cooldown(base : Int32) : Time::Span
cooldown(time : Time::Span) : Time::Span cooldown, cooldown_until : Time | Nil cooldown_until, debug_enabled : Bool | Nil debug_enabled, decrement_karma(amount : Int32 = 1) : Nil decrement_karma, formatted_name : String formatted_name, hide_karma : Bool | Nil hide_karma, id : UserID id, increment_karma(amount : Int32 = 1) : Nil increment_karma, joined : Time joined, karma : Int32 karma, last_active : Time last_active, left : Time | Nil left, left? : Bool left?, obfuscated_id : String obfuscated_id, obfuscated_karma : Int32 obfuscated_karma, rank : Int32 rank, realname : String realname, rejoin : Nil rejoin, remove_cooldown(override : Bool = false) : Bool remove_cooldown, remove_warning(amount : Int32, warn_lifespan : Time::Span) : Nil remove_warning, set_active : Nil set_active, set_left : Nil set_left, set_rank(rank : Int32) : Nil set_rank, set_tripcode(tripcode : String) : Nil set_tripcode, to_a : Array(UserID | String | Int32 | Time | Bool | Nil) to_a, toggle_debug : Nil toggle_debug, toggle_karma : Nil toggle_karma, tripcode : String | Nil tripcode, update_names(username : String | Nil, fullname : String) : Nil update_names, username : String | Nil username, warn(lifespan : Int32) : Nil warn, warn_expiry : Time | Nil warn_expiry, warnings : Int32 warnings
Constructor methods inherited from class PrivateParlorXT::User
new(id : UserID, username : String | Nil = nil, realname : String = "", rank : Int32 = 0, joined : Time = Time.utc, left : Time | Nil = nil, last_active : Time = Time.utc, cooldown_until : Time | Nil = nil, blacklist_reason : String | Nil = nil, warnings : Int32 = 0, warn_expiry : Time | Nil = nil, karma : Int32 = 0, hide_karma : Bool | Nil = false, debug_enabled : Bool | Nil = false, tripcode : String | Nil = nil)
new
Constructor Detail
Creates an instance of SQLiteUser
.
Arguments:
#id
: unique UserID
identifier for this user
#username
: username of this user; can be nil
#realname
: full name (first name + last name) of the user
#rank
: rank of this user, corresponding to either -10 (blacklisted) or one of the configurable ranks
#joined
: date and time the user joined the chat
#left
: date and time the user left the chat; if nil
, the user is still in the chat
#last_active
: date and time the user last sent a message or used a command
#cooldown_until
: date and time for until which the user cannot send messages; if nil
, the user is not in cooldown
#blacklist_reason
: described reason for blacklisting the user (seeBlacklistCommand
) ; set to nil
by default
#warnings
: number of warnings the user received from WarnCommand
or DeleteCommand
; cooldown times are based off of this value
#warn_expiry
: date and time in which one of the #warnings
will be removed; if nil
, user has no #warnings
to remove
#karma
: points the user acquired from upvotes, or lost from downvotes and warnings (see UpvoteHandler
, DownvoteHandler
)
#hide_karma
: toggle for receiving karma notifications (see ToggleKarmaCommand
); if true
, the user will not receive karma notifications
#debug_enabled
: toggle for debug mode (see ToggleDebugCommand
); if true
, the user will receive a copy of their sent message that everyone else received
#tripcode
: a name and password pairing used for generating pseudononyms attached to the user's message; if nil, user has no tripcode
Class Method Detail
Instance Method Detail
Returns the reason why the user was blacklisted, or nil
if a reason does not exist
Returns the Time
until which the user is in cooldown, or nil
if the user is not cooldowned
Returns true if the suer has debug mode enabled, false
otherwise
Returns true if the user has karma notifications disabled, false
otherwise
Returns the Time
the user joined the chat
Returns the user's current amount of karma
Returns the Time
the user was last active (i.e., the last time a message was sent or a command was used)
Returns the Time
the user left the chat, or nil
if the user has not left
Returns the user's current rank value
Returns the user's full name
Returns a String
containing the user's tripcode name and password for generating tripcodes, or nil
if the user has no tripcode set
Returns the user's unformatted username, or nil
if it does not exist
Returns the Time
when one of the #warnings
will expire, or nil
if such a time does not exit
Returns the number of warnings the user has