Last week my brother wanted to make a Music Bot for mumble that would stream music from di.fm. He found a pretty cool project that was started in ruby for a headless client. Here is the link to that project. Being a ruby inclined person this seemed like a chance to relax and do some code tinkering.
After an hour or so I came up with a small DSL that you can use with this project to do things with the Bot. So far it’s not to extensive but I can see myself moving this into a gem that has more power to it. Here is what I have so far.
|
The d_bot.rb file is an example of the mumble bot receiving a command. This command is triggered by the mumblebot when you message it “!setvol 80”. The bang denotes that it is a command and all other text past the command is trimmed and passed to the do block to be used. This is a simple example, I would suggest guarding against injection attacks.
|