telegram-support-bot 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aa04c608a30e8eb69bd222ab37e804224d4850472bc183d52dee74b397557c1
4
- data.tar.gz: a84baa26e47cb70191bc6b5736e86de0187efc799f1735b47b31114c03d7066d
3
+ metadata.gz: 628391b6587ec2b35dc5ce2984276eb42f4f5d5e992205ef06682f26ad41b8cf
4
+ data.tar.gz: 9edfd943aee7356088dede4f647609ee9f9c6cc34d9ba82a3bbdb61feef241fa
5
5
  SHA512:
6
- metadata.gz: a4e14a5cc0d07a7f05764eaf0577eb965ef9db5e86e276d74196ed3e08c9f0956315e0bec3e9b5b5b2ec1b94f7429186e299b16a80473fff24731122ba481263
7
- data.tar.gz: b875c18abaef4ad4dc5ce57d2e94635f354ca3e69d055fc2e9a0f8bdf626527dcd3ba16a021decd58d30746d0dfc7900f21aff707223955ccba8661d051ddb36
6
+ metadata.gz: 98fb134361de2705a30e239708f317565aaa50728a1a6516516ea6e4728bb216b1c6e2a7195996a8337fe46d85b8ddb77b3185122ada7f9b7088666742d64d0e
7
+ data.tar.gz: 205c10c6546720fabe6d1167846409f9f08cfd9fa264ee8e2218f973c032556d5742766c069cb3a1fedced5e2db6489a220601bf315a5f91d4841349daa27f45
data/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
- ## [0.1.14] - 2026-02-26
7
+ ## [0.1.15] - 2026-02-26
8
8
 
9
9
  ### Added
10
10
  - Optional `forward_start_to_support` configuration to forward the first user `/start`
@@ -15,6 +15,8 @@ All notable changes to this project will be documented in this file.
15
15
  ### Fixed
16
16
  - Initial `/start` forwarding is now fail-safe: errors in forwarding/persisting first-message
17
17
  marker no longer crash update processing and block subsequent updates.
18
+ - Redis-backed marker storage for update/start dedup now writes JSON objects (not scalar booleans),
19
+ fixing `JSON::GeneratorError: only generation of JSON objects or arrays allowed` on stricter runtimes.
18
20
 
19
21
  ## [0.1.12] - 2026-02-26
20
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TelegramSupportBot
4
- VERSION = "0.1.14"
4
+ VERSION = "0.1.15"
5
5
  end
@@ -526,25 +526,41 @@ module TelegramSupportBot
526
526
  return unless should_forward_start_to_support?(chat_id)
527
527
  return unless forward_message_to_support_chat(message, chat_id: chat_id)
528
528
 
529
- start_forwarded_users[chat_id] = true
529
+ start_forwarded_users[chat_id] = start_forwarded_marker_value
530
530
  rescue StandardError => error
531
531
  warn_start_forwarding_failure(chat_id: chat_id, message_id: message['message_id'], error: error)
532
532
  end
533
533
 
534
534
  def start_forwarded_to_support?(chat_id)
535
- !start_forwarded_users[chat_id].nil?
535
+ marker_present?(start_forwarded_users[chat_id])
536
536
  end
537
537
 
538
538
  def duplicate_update?(update_id)
539
539
  return false if update_id.nil?
540
540
 
541
- !processed_updates[update_id].nil?
541
+ marker_present?(processed_updates[update_id])
542
542
  end
543
543
 
544
544
  def mark_update_as_processed(update_id)
545
545
  return if update_id.nil?
546
546
 
547
- processed_updates[update_id] = true
547
+ processed_updates[update_id] = processed_update_marker_value
548
+ end
549
+
550
+ def marker_present?(value)
551
+ return false if value.nil?
552
+ return value if value == true || value == false
553
+ return value.fetch(:present, value['present']) if value.is_a?(Hash)
554
+
555
+ true
556
+ end
557
+
558
+ def start_forwarded_marker_value
559
+ { present: true }
560
+ end
561
+
562
+ def processed_update_marker_value
563
+ { present: true }
548
564
  end
549
565
 
550
566
  def warn_start_forwarding_failure(chat_id:, message_id:, error:)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-support-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev