Sha256: 7697d8b9b7b39ee6c8e0b3d0ed9baf21db83fd23a2c0ed69a05b51d062c1ed8b

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

require 'slack-ruby-bot'

SlackRubyBot::Client.logger.level = Logger::WARN

class WeatherBot < SlackRubyBot::Bot
  help do
    title 'Weather Bot'
    desc 'This bot tells you the weather.'

    command 'clouds' do
      desc 'Tells you how many clouds there\'re above you.'
    end

    command 'What\'s the weather in <city>?' do
      desc 'Tells you the weather in a <city>.'
      long_desc "Accurate 10 Day Weather Forecasts for thousands of places around the World.\n" \
        'We provide detailed Weather Forecasts over a 10 day period updated four times a day.'
    end
  end

  match(/^How is the weather in (?<location>\w*)\?$/i) do |client, data, match|
    client.say(channel: data.channel, text: "The weather in #{match[:location]} is nice.")
  end
end

WeatherBot.run

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-bot-0.16.1 examples/weather/weatherbot.rb
slack-ruby-bot-0.16.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.15.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.14.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.13.0 examples/weather/weatherbot.rb