Module: INatChannel::Telegram
- Defined in:
- lib/inat-channel/telegram.rb
Constant Summary collapse
- TELEGRAM_API =
'https://api.telegram.org/bot'
Class Method Summary collapse
Class Method Details
.notify_admin(text) ⇒ Object
27 28 29 30 31 |
# File 'lib/inat-channel/telegram.rb', line 27 def notify_admin text (IC::CONFIG.dig(:tg_bot, :admin_id), "iNatChannel: #{text}") rescue IC::logger.error "Admin notify failed" end |
.send_observation(observation) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/inat-channel/telegram.rb', line 13 def send_observation observation photos = IC::list_photos observation = IC:: observation unless photos.empty? msg_id = send_media_group IC::CONFIG.dig(:tg_bot, :chat_id), photos[0..9], else msg_id = IC::CONFIG.dig(:tg_bot, :chat_id), end IC::logger.info "Posted #{observation[:id]} (#{photos.size} photos)" msg_id end |