Screenshot / Code Snippet
Here's some sample usage:
cb = ChatBot.new(ENV['ChatXUsername'], ENV['ChatXPassword'])
cb.login
cb.gen_hooks do
room 63296 do # Room ID of The Closet, a testing room for ChatX
command("!!/alive") { say "I'm alive!" }
command "!!/sum" do |*args|
say "The sum is: #{args.map(&:to_i).sum}"
end
on "message" do |e|
reply_to e, "You said: #{e.body}"
end
end
end
You can find more documentation and sample code in the README.
About
I built this library because I saw no suitable alternative for ruby, my favorite language. I also thought it'd be fun to reverse engineer SE Chat, so I did. Now I've got a project. Yay!
License
This project is released under the MIT License. Any contributions are welcome via pull requests. Feature requests can be made via issues or in chat.
Download
Although the library is published on rubygems, the version there will frequently be outdated. To keep up to date please install from GitHub. The master branch should never be broken, so bundle update
regularly. This is easy if you're using the bundler gem, you can just add the following line to your Gemfile
:
gem 'chatx', git: 'https://gitlab.com/izwick-schachter/ChatX`, branch: 'master'
Platform
This library should work anywhere ruby will run. That means definitely macOS/Linux, and possibly windows.
Contact
I made this library (with some help from @ArtOfCode and others). If you are getting started, I know that documentation is poor, so please ping me in chat. I can be found in either of the two testing rooms for this library, Under the Bed and The Closet. Ping me whenever, I should respond within 48 hours.
In addition, if you have any feature requests, ping me in chat. I would be more than happy to try to add functions you need or to help you better use ChatX.
Dependencies
- Developed with MRI Ruby 2.5.0
- WebSocket client written with websocket-driver (with help from permessage-deflate)
- HTML/XML parsing with nokogiri
- Parsing of chat message with help from htmlentities
- HTTP requests and persistence and cookies and awesomeness from mechanize