Sha256: fa39281616348dcf9d62844474b88a98422e838fadf1210ecbc1dc3300260e39

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

require 'httpx'

require_relative 'lib/adapter'

module Rodbot
  class Plugins
    class WordOfTheDay
      class Schedule
        def initialize
          Clockwork.every(1.day, -> { Rodbot.say "Word of the day: #{message}" }, at: time)
        end

        private

        def time
          Rodbot.config(:plugin, :word_of_the_day, :time) || '12:00'
        end

        def languages
          Rodbot.config(:plugin, :word_of_the_day, :languages) || %w(english)
        end

        def message
          languages.map { ::WordOfTheDay::Adapter.new(_1).message }.compact.join(' / ')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rodbot-0.4.4 lib/rodbot/plugins/word_of_the_day/schedule.rb