Class: Boty::Slack::Message
- Inherits:
-
Object
- Object
- Boty::Slack::Message
- Defined in:
- lib/boty/slack/message.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#team ⇒ Object
Returns the value of attribute team.
-
#text ⇒ Object
Returns the value of attribute text.
-
#ts ⇒ Object
Returns the value of attribute ts.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #from?(author) ⇒ Boolean
-
#initialize(data, match: nil) ⇒ Message
constructor
A new instance of Message.
- #match!(regex) ⇒ Object
Constructor Details
#initialize(data, match: nil) ⇒ Message
Returns a new instance of Message.
7 8 9 10 11 12 13 14 |
# File 'lib/boty/slack/message.rb', line 7 def initialize(data, match: nil) @text = data["text"] @user = Slack.users.info data["user"] @channel = data["channel"] @ts = data["ts"] @team = data["team"] @match = match end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
4 5 6 |
# File 'lib/boty/slack/message.rb', line 4 def channel @channel end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
5 6 7 |
# File 'lib/boty/slack/message.rb', line 5 def match @match end |
#team ⇒ Object
Returns the value of attribute team.
4 5 6 |
# File 'lib/boty/slack/message.rb', line 4 def team @team end |
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'lib/boty/slack/message.rb', line 4 def text @text end |
#ts ⇒ Object
Returns the value of attribute ts.
4 5 6 |
# File 'lib/boty/slack/message.rb', line 4 def ts @ts end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/boty/slack/message.rb', line 4 def user @user end |
Instance Method Details
#from?(author) ⇒ Boolean
20 21 22 23 24 25 26 |
# File 'lib/boty/slack/message.rb', line 20 def from?() if .respond_to? :id @user.id == .id else @user.id == end end |
#match!(regex) ⇒ Object
16 17 18 |
# File 'lib/boty/slack/message.rb', line 16 def match!(regex) @match = regex.match @text end |