File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 11Style/FrozenStringLiteralComment :
2+ Enable : false
3+ Style/FrozenStringLiteralComment :
4+ Enable : false
5+ Naming/FileName :
26 Enable : false
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
12require 'httparty'
23require 'nokogiri'
34
45module JokerTheNerd
56 module Commands
7+ # Slack bot commands
68 class Jokes < SlackRubyBot ::Commands ::Base
79 command 'jokes_image' do |client , data , _match |
810 client . say ( channel : data . channel , text : JokesImage . image_random_joke )
@@ -18,12 +20,14 @@ class Jokes < SlackRubyBot::Commands::Base
1820 end
1921 end
2022
23+ # Say hello class implementation
2124 class HelloText
2225 def self . say_hello
2326 'Heyyy, ready for some humors?'
2427 end
2528 end
2629
30+ # Text based jokes implementation
2731 class JokesText
2832 def self . text_jokes
2933 @text_url = 'https://upjoke.com/programmer-jokes'
@@ -37,6 +41,7 @@ def self.text_random_joke
3741 end
3842 end
3943
44+ # Image based jokes implentation
4045 class JokesImage
4146 def self . image_jokes
4247 @base_url = 'https://www.hongkiat.com/blog/programming-jokes/'
Original file line number Diff line number Diff line change @@ -4,10 +4,22 @@ class SlackBot < SlackRubyBot::Bot
44 title 'Joker The Nerd Bot'
55 desc 'This bot serves you with some programming humors'
66
7- command :get_all_humors do
8- title 'get_all_humors'
9- desc 'Images of humor'
10- long_desc 'Images of programming humors'
7+ command :say_hello do
8+ title 'Greet the Bot'
9+ desc 'The Bot greets back'
10+ long_desc 'The bot responds with a greeting string'
11+ end
12+
13+ command :jokes_text do
14+ title 'Joke Text'
15+ desc 'Get random Programming Jokes as Text'
16+ long_desc 'The Bot craws and scraps the web, returning a random joke texts'
17+ end
18+
19+ command :jokes_image do
20+ title 'Joke Image'
21+ desc 'Get random Programming Jokes as Image'
22+ long_desc 'The Bot craws and scraps the web, returning a random joke image'
1123 end
1224 end
1325 end
You can’t perform that action at this time.
0 commit comments