Permalink
Browse files

add method for gaining operator privileges

Closes gh-73
  • Loading branch information...
1 parent 0b8e739 commit 1ab641f85db155853b60b9f52a31bf6f9cf34d73 @dominikh dominikh committed Apr 1, 2012
Showing with 16 additions and 0 deletions.
  1. +4 −0 docs/changes.md
  2. +12 −0 lib/cinch/bot.rb
View
@@ -10,6 +10,10 @@
### New methods
+#### {Cinch::Bot}
+
+- {Cinch::Bot#oper}
+
#### {Cinch::User}
- {Cinch::User#oper?}
View
@@ -430,6 +430,18 @@ def nick=(new_nick)
@irc.send "NICK #{new_nick}"
end
+ # Gain oper privileges.
+ #
+ # @param [String] password
+ # @param [String] user The username to use. Defaults to the bot's
+ # nickname
+ # @since 2.1.0
+ # @return [void]
+ def oper(password, user = nil)
+ user ||= self.nick
+ @irc.send "OPER #{user} #{password}"
+ end
+
# Try to create a free nick, first by cycling through all
# available alternatives and then by appending underscores.
#

0 comments on commit 1ab641f

Please sign in to comment.