Sha256: 3b4fff0e2a36f63a710126a421b86347b744660d2f323d90d742ab307afea514
Contents?: true
Size: 750 Bytes
Versions: 3
Compression:
Stored size: 750 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' channel = MadChatter::find_channel_by_id(message.channel) channel.send_message(img_msg) stop_message_handling end end def parse_url(message_text) @@regex.match(message_text).captures[0] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mad_chatter-0.3.2 | lib/mad_chatter/message_listeners/image.rb |
mad_chatter-0.3.1 | lib/mad_chatter/message_listeners/image.rb |
mad_chatter-0.3.0 | lib/mad_chatter/message_listeners/image.rb |