Wednesday, July 15, 2026 1:09:40 AM
> project show esm_bot
A sophisticated Discord bot that bridges Arma 3 Exile servers with Discord communities. Built in Ruby with secure TCP communication, it delivers territory management, real-time notifications, and comprehensive server administration right in your Discord channels.
Details
> database.rb
# frozen_string_literal: true

module ESM
  class Database
    def self.connect!
      ActiveRecord::Base.configurations = config
      ActiveRecord::Base.establish_connection(ESM.env.to_sym)
    end

    def self.connected?
      ActiveRecord::Base.connected?
    end

    def self.config
      @config ||= YAML.safe_load(
        ERB.new(
          File.read(ESM_CORE_PATH.join("config", "database.yml"))
        ).result,
        aliases: true
      )
    end

    def self.with_connection(&)
      ESM::ApplicationRecord
        .connection_pool
        .with_connection(prevent_permanent_checkout: true, &)
    end
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 43aa0d7