Sha256: 56da849aeee6fee6e409e852f548c3f43747acc68c9f701f1248e5d661917601
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
module MadChatter module MessageListeners class Image include MadChatter::Actions @@regex = %r{^/img (.+)} def handle(message) if message.text =~ @@regex img_url = parse_url(message.text) img_msg = MadChatter::Message.new('message', img_url, message.token, message.channel) img_msg.html = "<img src='#{img_url}'>" img_msg.growl = message.username + ' has shared an image' MadChatter.send_message(message) stop_message_handling end end def parse_url(message_text) @@regex.match(message_text).captures[0] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mad_chatter-0.3.4 | lib/mad_chatter/message_listeners/image.rb |
mad_chatter-0.3.3 | lib/mad_chatter/message_listeners/image.rb |