Sha256: 766fb57bb220589624e1b8cd678c9ecd900fede0549f9b3679c3583de6c623d3
Contents?: true
Size: 691 Bytes
Versions: 8
Compression:
Stored size: 691 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'telegram/bot' module Ehbrs module Telegram class MessageSending acts_as_immutable immutable_accessor :bot_token, :message immutable_accessor :recipient_id, type: :array def run ::Telegram::Bot::Client.run(prop(:bot_token)) do |bot| prop(:recipient_ids).each do |recipient_id| bot.api.sendMessage(chat_id: recipient_id, text: prop(:message)) end end end private def prop(attribute) r = send(attribute) return r if r.present? raise "Attribute #{attribute} is blank" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems