Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/http'
- def check_file_for_things filename, url
- begin
- File.open(filename,"r+") do |f|
- output = ""
- f.each do |line|
- puts "parsing line #{line}"
- #if !anything if line =~/\s!.*\w/
- if line =\s!command
- puts "line #{line} found and removed calling #{url}"
- html = Net::HTTP.get(URI.parse(url))
- else
- output << line
- end
- end
- f.pos = 0
- f.print output
- f.truncate(f.pos)
- end
- rescue => e
- puts "something had gone wrong: #{e}"
- end
- end
- filename = 'c:\steamlogs\Battlefield Goons.txt'
- url = 'http://bfgoons.com/command.php'
- while (true)
- puts "checking file #{filename} for things"
- check_file_for_things filename, url
- puts "sleepin..."
- sleep(1)
- puts "i'm awake"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement