Wednesday, July 15, 2026 3:59:55 AM
> bot_attribute.rb
# 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
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 43aa0d7