Module: Svenbot::Message

Included in:
Bot
Defined in:
lib/svenbot/message.rb

Overview

A factory for messages.

Instance Method Summary collapse

Instance Method Details

#html_message(contents) ⇒ Object

Create a Jabber::Message with both HTML and text body. Pass in a string of HTML.



12
13
14
15
16
17
18
19
# File 'lib/svenbot/message.rb', line 12

def html_message(contents)
  msg = Jabber::Message.new
  msg.type = :chat
  html = Jabber::XHTML::HTML.new(contents)
  msg.add(html)
  msg.body = html.to_text
  return msg
end