telegram-support-bot 0.1.04 → 0.1.06
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 443be16da398a9055e09a98aa7a828d887baa3828916f0afa2a509e9e228d1a3
|
4
|
+
data.tar.gz: 959d8dbe4eaeb3660bd688dafa26712575af0b0269d94acbea1e294ce9901af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfa333fb11bd3f68551a68a7b25f17d09a3840c5326ae65a0872741c326c7956e9d7ccdfe74f33d2e7f017f8e307f9fccd804a744df81004a05a6b460da0f7a
|
7
|
+
data.tar.gz: 75a42d5e219572496a5d3011a1c66373878a1cba685fbf7ff8574e9a00b451002df6b082f998e6d6be77c7b3dd8972d9d9e7faaaa3c486c83feece51724c8294
|
@@ -3,14 +3,15 @@
|
|
3
3
|
module TelegramSupportBot
|
4
4
|
class Configuration
|
5
5
|
attr_accessor :adapter, :adapter_options, :support_chat_id, :welcome_message,
|
6
|
-
:auto_away_message, :auto_away_interval
|
6
|
+
:auto_away_message, :auto_away_interval, :ignore_unknown_commands
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@adapter
|
10
|
-
@adapter_options
|
11
|
-
@welcome_message
|
12
|
-
@
|
13
|
-
@
|
9
|
+
@adapter = :telegram_bot
|
10
|
+
@adapter_options = {}
|
11
|
+
@welcome_message = 'Welcome! How can we help you?'
|
12
|
+
@ignore_unknown_commands = true
|
13
|
+
@auto_away_interval = 10 # seconds
|
14
|
+
@auto_away_message = 'We are sorry, all operators are busy at the moment. Please wait'
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/telegram_support_bot.rb
CHANGED
@@ -48,7 +48,6 @@ module TelegramSupportBot
|
|
48
48
|
|
49
49
|
def process_message(message)
|
50
50
|
@message_chat_id = message['chat']['id']
|
51
|
-
ap message
|
52
51
|
|
53
52
|
if message_chat_id == configuration.support_chat_id
|
54
53
|
process_support_chat_message(message)
|
@@ -93,8 +92,10 @@ module TelegramSupportBot
|
|
93
92
|
send_welcome_message(chat_id: message_chat_id)
|
94
93
|
else
|
95
94
|
# Respond to unknown commands
|
96
|
-
|
97
|
-
|
95
|
+
unless configuration.ignore_unknown_commands
|
96
|
+
unknown_command_response = "I don't know the command #{command}. Please use /start to begin or check the available commands."
|
97
|
+
adapter.send_message(chat_id: message_chat_id, text: unknown_command_response)
|
98
|
+
end
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|