Like to code?
New: join the CodeChallenge group: http://www.icanhazchat.com/group/codechallenge.
The challenge has been to find small projects that wouldn’t compromise the security of the site, AND would require alot of explanation, AND would be easy to review/merge the changes.
Contributing coding help gets you the ’hacker’ badge on your profile page and more karma. The karma amount is entirely subjective, but probably won’t be based on eye color or shoe size.
Write a bot
[june 2012] ICHC now has a bot API for writing in-chat games, etc
You can right-click and save this file to your local drive, to create/debug your own bot: unittest_game_api.htm.
What a bot must implement (required)
- var bot_name
- a global string that describes the bot
- var bot_active
- a global boolean that indicates when the bot is running
- function botStart()
- called when the bot is started. Initialize your data and start interacting with the room here
- function botEnd()
- called when the bot is shutting down (the game is over, etc).
What a bot could implement (optional)
- botProcessLine(who, line)
- If a bot implements this, it will be called every time someone (’who’) sends a message (’line’) to the room
- function botHi(who)
- If a bot implements this, it will be called every time someone enters the room
- function botBye(who)
- If a bot implements this, it will be called every time someone leaves the room
- function botCamUp(who)
- If a bot implements this, it will be called every time someone cams up
- function botCamDown(who)
- If a bot implements this, it will be called every time someone cams down
What is available for a bot to use
- function botSend(s)
- sends the string ’s’ to the room. Currently only text messages (not commands) can be sent. Do not use it to the flood the room.
- function log(s)
When you are ready to run a bot in a room, use the ’/bot-start’ command to added your bot source to the page. You can unload the bot by refreshing the page. Run/test it in small test rooms, get room mods permission before running in larger rooms.
Created something cool? Share it with others by posting it to the ’code codechallenge’ group.
From the README.txt
This project contains automated selenium (http://seleniumhq.org) browser tests for http://www.icanhazchat.com.
These tests use the Ruby driver.
"gem install selenium-webdriver"
(you will probably also need http://rubygems.org/gems/ffi)
ICanHazChat specific information:
1. create an account name that starts with "selenium" and use that while running tests. This is set in account_name.txt and used by tests.rb.
2. only enter rooms that have names that start with "test_". Tests.rb already automatically does this for you.
Some test ideas:
- create two different browser instances and enter the same room, one account is mod and the other isn’t, test range of commands
- room settings: save settings, verify they persist in the room settings page, verify they are active in the room.
- user settings: save settings, verify they persist
- offline messages: send them to yourself (don’t spam others), delete them, mark them unread, etc
svn checkout http://ichc-browser-tests.googlecode.com/svn/trunk/ ichc-browser-tests-read-only