Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add action_reply convenience method #97

Closed
wants to merge 1 commit into from

2 participants

@jayg

Added action_reply and safe_action_reply.

Safe_action_reply probably won't get much use but.. eh, there's a safe_reply so why not?

I had considered giving action_reply a 'postfix' option like reply has 'prefix' so you could do m.action_reply "pokes", true.... for * cinchbot pokes nickname.... but that seemed like taking it too far. It's easy to get the nick and put it where you want which might not be at the end of the message.

Thoughts?

@dominikh
Owner

Merged into master.

@dominikh dominikh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2012
  1. @jayg
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 0 deletions.
  1. +18 −0 lib/cinch/message.rb
View
18 lib/cinch/message.rb
@@ -176,6 +176,24 @@ def safe_reply(text, prefix = false)
@target.safe_send(text)
end
+ # Reply to a message with an action.
+ #
+ # @param [String] text the action message
+ # @return [void]
+ def action_reply(text)
+ text = text.to_s
+ @target.action(text)
+ end
+
+ # Like #action_reply, but using {Target#safe_action} instead
+ #
+ # @param (see #action_reply)
+ # @return (see #action_reply)
+ def safe_action_reply(text)
+ text = text.to_s
+ @target.safe_action(text)
+ end
+
# Reply to a CTCP message
#
# @return [void]
Something went wrong with that request. Please try again.