# frozen_string_literal: true
module ESM
class BotAttribute < ApplicationRecord
# =============================================================================
# INITIALIZE
# =============================================================================
# =============================================================================
# DATA STRUCTURE
# =============================================================================
attribute :maintenance_mode_enabled, :boolean, default: false
attribute :maintenance_message, :string, default: nil
attribute :status_type, :string, default: "PLAYING"
attribute :status_message, :string, default: "!register"
attribute :community_count, :integer, default: 0
attribute :server_count, :integer, default: 0
attribute :user_count, :integer, default: 0
# =============================================================================
# ASSOCIATIONS
# =============================================================================
# =============================================================================
# VALIDATIONS
# =============================================================================
# =============================================================================
# CALLBACKS
# =============================================================================
# =============================================================================
# SCOPES
# =============================================================================
# =============================================================================
# CLASS METHODS
# =============================================================================
def self.recalculate
all.first.update!(
community_count: Community.all.size,
server_count: Server.all.size,
user_count: User.where.not(steam_uid: nil).size
)
end
# =============================================================================
# INSTANCE METHODS
# =============================================================================
end
end