Sha256: 595b00f2e2ed1a08cc720a5618a89ea7e360664433bebeda83fa87657a513a95

Contents?: true

Size: 785 Bytes

Versions: 13

Compression:

Stored size: 785 Bytes

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
slack-ruby-bot-0.12.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.11.2 examples/weather/weatherbot.rb
slack-ruby-bot-0.11.1 examples/weather/weatherbot.rb
slack-ruby-bot-0.11.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.5 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.4 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.3 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.2 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.1 examples/weather/weatherbot.rb
slack-ruby-bot-0.10.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.9.0 examples/weather/weatherbot.rb
slack-ruby-bot-0.8.2 examples/weather/weatherbot.rb
slack-ruby-bot-0.8.1 examples/weather/weatherbot.rb