Class: BotFramework::Message
- Inherits:
-
Object
- Object
- BotFramework::Message
- Defined in:
- lib/bot_framework/message.rb
Constant Summary collapse
- TEXT_FORMAT =
{ plain: 'plain', markdown: 'markdown', xml: 'xml' }.freeze
- ATTACHMENT_LAYOUT =
{ list: 'list', carousel: 'carousel' }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #add_attachment ⇒ Object
- #add_entity ⇒ Object
- #address ⇒ Object
- #attachment_layout ⇒ Object
- #attachments ⇒ Object
- #compose(prompts, *args) ⇒ Object
- #entities ⇒ Object
-
#initialize(_session = nil) ⇒ Message
constructor
A new instance of Message.
- #ntext(msg, _msg_plural, count) ⇒ Object
- #source_event ⇒ Object
- #summary ⇒ Object
- #text(text, *_args) ⇒ Object
- #text_format(style) ⇒ Object
- #text_locale(locale) ⇒ Object
- #timestamp ⇒ Object
- #to_message ⇒ Object
Constructor Details
#initialize(_session = nil) ⇒ Message
Returns a new instance of Message.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bot_framework/message.rb', line 13 def initialize(_session = nil) @data = {} @data[:type] = 'consts.MessageType' # FIXME @data[:agent] = 'consts.agent' if @session m = @session. @data[:source] = m[:source] if m[:source] @data[:text_locale] = m[:text_locale] if m[:text_locale] @data[:address] = m[:address] if m[:address] end end |
Class Method Details
.compose_prompt ⇒ Object
77 |
# File 'lib/bot_framework/message.rb', line 77 def compose_prompt; end |
.random_prompt ⇒ Object
75 |
# File 'lib/bot_framework/message.rb', line 75 def random_prompt; end |
Instance Method Details
#add_attachment ⇒ Object
60 |
# File 'lib/bot_framework/message.rb', line 60 def ; end |
#add_entity ⇒ Object
64 |
# File 'lib/bot_framework/message.rb', line 64 def add_entity; end |
#address ⇒ Object
66 |
# File 'lib/bot_framework/message.rb', line 66 def address; end |
#attachment_layout ⇒ Object
56 |
# File 'lib/bot_framework/message.rb', line 56 def ; end |
#attachments ⇒ Object
58 |
# File 'lib/bot_framework/message.rb', line 58 def ; end |
#compose(prompts, *args) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/bot_framework/message.rb', line 47 def compose(prompts, *args) if prompts @data[:text] = Message.compose_prompt(@session, prompts, *args) self end end |
#entities ⇒ Object
62 |
# File 'lib/bot_framework/message.rb', line 62 def entities; end |
#ntext(msg, _msg_plural, count) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/bot_framework/message.rb', line 40 def ntext(msg, _msg_plural, count) fmt = count == 1 ? self.class.random_prompt(msg) : self.class.random_prmpt() fmt = @session.get_text(fmt) if @session @data[:text] = fmt, count # FIXME self end |
#source_event ⇒ Object
70 |
# File 'lib/bot_framework/message.rb', line 70 def source_event; end |
#summary ⇒ Object
54 |
# File 'lib/bot_framework/message.rb', line 54 def summary; end |
#text(text, *_args) ⇒ Object
35 36 37 38 |
# File 'lib/bot_framework/message.rb', line 35 def text(text, *_args) @data[:text] = text.present? ? format_text(text) : '' self end |
#text_format(style) ⇒ Object
30 31 32 33 |
# File 'lib/bot_framework/message.rb', line 30 def text_format(style) @data[:text_format] = style self end |
#text_locale(locale) ⇒ Object
25 26 27 28 |
# File 'lib/bot_framework/message.rb', line 25 def text_locale(locale) @data[:text_locale] = locale self end |
#timestamp ⇒ Object
68 |
# File 'lib/bot_framework/message.rb', line 68 def ; end |
#to_message ⇒ Object
72 |
# File 'lib/bot_framework/message.rb', line 72 def ; end |