Skip to content

Commit a8ea07b

Browse files
feat(slack-bot): fix image jokes
1 parent d3933b9 commit a8ea07b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bin/bot.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def initialize
1919

2020
def images
2121
imgs = @parsed_page.css('figure.entry-image img[src]').select { |image| image['src'].start_with?('https') }
22-
puts imgs.sample
22+
images_urls = imgs.map { |t| t[:src] }
23+
puts images_urls
2324
end
2425

2526
def text_jokes

lib/command/slack_command.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def self.image_jokes
4040
unparsed_page = HTTParty.get(@base_url)
4141
@parsed_page = Nokogiri::HTML(unparsed_page.body)
4242
imgs = @parsed_page.css('figure.entry-image img[src]').select { |image| image['src'].start_with?('https') }
43-
imgs.sample
43+
images_urls = imgs.map { |t| t[:src] }
44+
images_urls.sample
4445
end
4546
end
4647
end

0 commit comments

Comments
 (0)