Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
sinatra-cheat commands!
Browse files Browse the repository at this point in the history
  • Loading branch information
vangberg committed Mar 14, 2009
1 parent 6c76781 commit 2282f67
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
In channel:
nancie, tweet this: some interesting stuff
nancie, follow frankieboy
nancie, tag 1234 as foo bar
nancie, show franky foo bar

In private:
/msg nancie allow some_other_user
Expand Down
19 changes: 19 additions & 0 deletions bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ def ensure_permissions
end
end

on :channel, /^#{Nancie.config['irc']['nick']}.* show (\S+) (.*)/ do
ensure_permissions
tags = match[1].tr(" ", "/")
msg channel, "#{match[0]}, take a look at http://sinatra-cheat.heroku.com/#{tags}"
end

on :channel, /^#{Nancie.config['irc']['nick']}.* tag (\d+) as (.*)/ do
ensure_permissions
begin
RestClient.post "http://sinatra-cheat.heroku.com/",
:gist => match[0],
:tags => match[1]
tags = match[1].tr(" ", "/")
msg channel, "#{nick}, http://sinatra-cheat.heroku.com/#{tags}"
rescue
msg channel, "#{nick}, something went wrong.."
end
end

on :private, /^allow (\S+)/ do
ensure_permissions

Expand Down

0 comments on commit 2282f67

Please sign in to comment.