# gem install teeworlds_client # ruby thisfile.rb require 'teeworlds_client' client = TeeworldsClient.new(verbose: false) client.on_chat do |_, msg| puts "[chat] #{msg.message}" if msg.message.start_with? "say " client.rcon("say #{msg.message[4..].gsub(';', '_')}") end end client.on_connected do |_| client.rcon_auth(password: 'xxx') end client.on_rcon_line do |ctx| puts "[rcon] #{ctx.data[:line]}" end # properly disconnect on ctrl+c Signal.trap('INT') do client.disconnect end # ger2 client.connect('176.9.114.238', 8314, detach: false)