Sha256: e4cabf4d1e8094780fd555f79219bec333df95a17fe0f02ae470c62c906d8aae
Contents?: true
Size: 662 Bytes
Versions: 1
Compression:
Stored size: 662 Bytes
Contents
module TelegramChatbot class Notification def self.notify_async(message, groups=[]) return unless bot.present? && bot.actived? NotificationWorker.perform_async(message, groups) end def self.notify(message, groups=[]) groups.each do |group| client.send_message(chat_id: group.chat_id, text: message, parse_mode: :HTML) rescue ::Telegram::Bot::Forbidden => e group.update(actived: false, reason: e) end end private def self.client ::Telegram::Bot::Client.new(bot.token, bot.username) end def self.bot ::TelegramChatbot::TelegramBot.first end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
telegram_chatbot-0.1.1 | app/models/telegram_chatbot/notification.rb |