telegram-support-bot 0.1.08 → 0.1.09
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +5 -0
- data/lib/telegram_support_bot/configuration.rb +3 -0
- data/lib/telegram_support_bot/version.rb +1 -1
- data/lib/telegram_support_bot.rb +2 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15900469360f291d85f69a938dc8f25cc9826ec0fab4105c954e0f58aea48868
|
|
4
|
+
data.tar.gz: 441423cab220f879327d6474bafb069c8fa099966f7cc45c6ac2896944a52238
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fa0913384b4a0ecc87dd7c37cc546fc6d8a5e937c9154b7bdeb91d80ed3070cb33d4f5bc6d9d051fe5d84b865bfc904638528e7259cb4a366f5e978e448ecf3
|
|
7
|
+
data.tar.gz: c844cfaf107d7bed62378b7dfd170d28ee8a4e81f17802c7924cc8629a0dc3485242b5966dbc0371bdddffa2bbd5e861068e0970ebb5d5561c7da1b3a663b06d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.09] - 2026-02-13
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Configurable support-chat non-command behavior:
|
|
11
|
+
`ignore_non_command_messages` (default `true`) and
|
|
12
|
+
`non_command_message_response` for optional acknowledgement text.
|
|
13
|
+
|
|
5
14
|
## [0.1.08] - 2026-02-13
|
|
6
15
|
|
|
7
16
|
### Added
|
data/README.md
CHANGED
|
@@ -43,6 +43,11 @@ TelegramSupportBot.configure do |config|
|
|
|
43
43
|
config.adapter_options = { token: 'YOUR_TELEGRAM_BOT_TOKEN' }
|
|
44
44
|
config.support_chat_id = 'YOUR_SUPPORT_CHAT_ID'
|
|
45
45
|
config.welcome_message = 'Hi! How can we help you?'
|
|
46
|
+
# Support-chat noise control:
|
|
47
|
+
# true (default) -> ignore non-command messages in support chat
|
|
48
|
+
# false -> reply with non_command_message_response
|
|
49
|
+
config.ignore_non_command_messages = true
|
|
50
|
+
config.non_command_message_response = 'I only respond to commands. Please use /start.'
|
|
46
51
|
# Optional: ask users to share their phone once for account lookup.
|
|
47
52
|
config.request_contact_on_start = true
|
|
48
53
|
# Optional: block forwarding until contact is shared.
|
|
@@ -4,6 +4,7 @@ module TelegramSupportBot
|
|
|
4
4
|
class Configuration
|
|
5
5
|
attr_accessor :adapter, :adapter_options, :support_chat_id, :welcome_message,
|
|
6
6
|
:auto_away_message, :auto_away_interval, :ignore_unknown_commands,
|
|
7
|
+
:ignore_non_command_messages, :non_command_message_response,
|
|
7
8
|
:request_contact_on_start, :require_contact_for_support, :contact_request_message,
|
|
8
9
|
:contact_received_message, :contact_invalid_message, :on_contact_received,
|
|
9
10
|
:state_store, :state_store_options, :mapping_ttl_seconds,
|
|
@@ -14,6 +15,8 @@ module TelegramSupportBot
|
|
|
14
15
|
@adapter_options = {}
|
|
15
16
|
@welcome_message = 'Welcome! How can we help you?'
|
|
16
17
|
@ignore_unknown_commands = true
|
|
18
|
+
@ignore_non_command_messages = true
|
|
19
|
+
@non_command_message_response = 'I received your message, but I only respond to commands. Please use /start to get started.'
|
|
17
20
|
@auto_away_interval = 10 # seconds
|
|
18
21
|
@auto_away_message = 'We are sorry, all operators are busy at the moment. Please wait'
|
|
19
22
|
@request_contact_on_start = false
|
data/lib/telegram_support_bot.rb
CHANGED
|
@@ -130,17 +130,14 @@ module TelegramSupportBot
|
|
|
130
130
|
elsif message['text']&.start_with?('/')
|
|
131
131
|
process_command(message, chat_id: chat_id)
|
|
132
132
|
else
|
|
133
|
-
|
|
134
|
-
# For now, let's just acknowledge the message
|
|
135
|
-
acknowledge_non_command_message(message, chat_id: chat_id)
|
|
133
|
+
acknowledge_non_command_message(message, chat_id: chat_id) unless configuration.ignore_non_command_messages
|
|
136
134
|
end
|
|
137
135
|
end
|
|
138
136
|
|
|
139
137
|
def acknowledge_non_command_message(message, chat_id:)
|
|
140
|
-
reply_message = 'I received your message, but I only respond to commands. Please use /start to get started.'
|
|
141
138
|
adapter.send_message(
|
|
142
139
|
chat_id: chat_id,
|
|
143
|
-
text:
|
|
140
|
+
text: configuration.non_command_message_response,
|
|
144
141
|
reply_to_message_id: message['message_id']
|
|
145
142
|
)
|
|
146
143
|
end
|