Sha256: fe0ff63ddce018190143236f9c3ff4e62de7bb1668eb8aafcdd58847c19395d2
Contents?: true
Size: 677 Bytes
Versions: 2
Compression:
Stored size: 677 Bytes
Contents
class QstatRequest def initialize(hostname) @result = JSON.parse(%x[qstat -json -P -qws #{hostname}]).first end def output <<~HEREDOC **#{address} | #{map} | #{numplayers}/#{maxplayers}** #{player_table} HEREDOC end def address @result["address"] end def map @result["map"] end def numplayers @result["numplayers"] end def maxplayers @result["maxplayers"] end def player_table players.sort_by { |player| player.team.number }.map(&:to_row).join("\n") end def players @result["players"].map do |player_data| Player.new(player_data) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qwtf_discord_bot-0.3.1 | lib/qstat_request.rb |
qwtf_discord_bot-0.3.0 | lib/qstat_request.rb |