Wednesday, July 15, 2026 2:55:40 AM
> user.rb
# frozen_string_literal: true

module Discordrb
  class User
    attr_writer :esm_user

    delegate :steam_uid, :id_defaults, :id_aliases, to: :esm_user

    def esm_user
      @esm_user ||= lambda do
        user = ESM::User.where(discord_id: id.to_s).first_or_create
        user.sync_discord_attributes!(self)
        user
      end.call
    end

    def to_h
      {
        id: id.to_s,
        username: username,
        avatar_url: avatar_url
      }
    end

    alias_method :attributes, :to_h
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 43aa0d7