abstract class PrivateParlorXT::Database
- PrivateParlorXT::Database
- Reference
- Object
Overview
A base class for Database
implementations, used for storing and retrieving data about users
Direct Known Subclasses
Defined in:
private-parlor-xt/database/database.crConstructors
Instance Method Summary
-
#active_users(exclude : UserID) : Array(UserID)
Queries the database for the most active users, ordered by highest ranking users first, then most active users.
-
#active_users : Array(UserID)
Queries the database for the most active users, ordered by highest ranking users first, then most active users.
-
#add_user(id : UserID, username : String | Nil, realname : String, rank : Int32) : User | Nil
Adds a user to the database
-
#blacklisted_users(time_limit : Time::Span) : Array(User)
Get an array of recently blacklisted users
-
#blacklisted_users : Array(User)
Get an array of blacklisted users
-
#close
Close connection to the
Database
-
#expire_warnings(warn_lifespan : Time::Span) : Nil
Queries the database for users with warnings and removes a warning
-
#get_user(id : UserID | Nil) : User | Nil
Get user by
UserID
-
#get_user_by_arg(arg : String) : User | Nil
Get user by a given arg, calling the appropriate function
-
#get_user_by_name(username : String) : User | Nil
Get user by username
-
#get_user_by_oid(oid : String) : User | Nil
Get user by a four-digit obfuscated ID
-
#inactive_users(time_limit : Time::Span) : Array(User) | Nil
Get users that have not been active within a given time limit
-
#invalid_rank_users(valid_ranks : Array(Int32)) : Array(User) | Nil
Get an array of users whose ranks are currently invalid
-
#motd : String | Nil
Gets the MOTD/rules, if they exist
-
#no_users? : Bool | Nil
Returns true if there are no users in the database False otherwise
-
#set_motd(text : String) : Nil
Sets the MOTD/rules to the given string
-
#update_user(user : User) : Nil
Updates a user with new data
-
#user_counts : NamedTuple(total: Int32, left: Int32, blacklisted: Int32)
Get the total count of users, users that have stopped the bot, and users that are blacklisted
-
#warned_users : Array(User) | Nil
Get an array of warned users
Constructor Detail
Instance Method Detail
Queries the database for the most active users, ordered by highest ranking users first, then most active users.
Use this to exclude a user from the result (i.e., when a user does not have debug mode enabled)
Queries the database for the most active users, ordered by highest ranking users first, then most active users.
Adds a user to the database
Get an array of recently blacklisted users
Queries the database for users with warnings and removes a warning
If the user still has warnings, the next time a warning is removed should be the current time plus the value of warn_lifespan
This should be invoked as a recurring task
Get user by a given arg, calling the appropriate function
Get user by a four-digit obfuscated ID
Get users that have not been active within a given time limit
Get an array of users whose ranks are currently invalid
Returns true if there are no users in the database False otherwise
Get the total count of users, users that have stopped the bot, and users that are blacklisted