Class: Kybus::CLI::Bot::BotGenerator

Inherits:
FileProvider show all
Defined in:
lib/kybus/cli/bot/file_providers/bot_generator.rb

Instance Method Summary collapse

Methods inherited from FileProvider

autoregister!, #bot_name, #bot_name_class, #bot_name_constantize, #bot_name_snake_case, #generate, #initialize, #keep_files, #skip_file?

Constructor Details

This class inherits a constructor from Kybus::CLI::Bot::FileProvider

Instance Method Details

#make_contentsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kybus/cli/bot/file_providers/bot_generator.rb', line 12

def make_contents
  <<~RUBY
    # frozen_string_literal: true

    class #{bot_name_class} < Kybus::Bot::Base
      def initialize(configs)
        super(configs)
        register_command('/hello') do
          send_message('Hi human')
        end
      end
    end
  RUBY
end

#saving_pathObject



8
9
10
# File 'lib/kybus/cli/bot/file_providers/bot_generator.rb', line 8

def saving_path
  'bot.rb'
end