telepost 0.10.0 → 0.11.0
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/Gemfile.lock +11 -11
- data/README.md +2 -2
- data/lib/telepost.rb +10 -4
- data/telepost.gemspec +1 -1
- 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: 669da4747151d6e7c97dd90ef240f9b702b17e8d80196351fba8d974a3516da4
|
|
4
|
+
data.tar.gz: d5454663c1acad864f0dc1a39fa68252d2a7dcf309dad3b59f76e15d0f171782
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 830a1c67439bc7f92afc8e23f75094c831e2d4f56113aa086471f877ca60bf6f28910a02e483701a2a154ee8141ba0dfdbbd3f63beba79f006fd2c1270db78c4
|
|
7
|
+
data.tar.gz: db75e8685f6ac4266807fe4c652eaf36ebba7fea3ac687ce8fb7619a42e0eb819dc1ff72efcf1ffbbc86f26dc2bd2825481c050c69a673955f789803853904f9
|
data/Gemfile.lock
CHANGED
|
@@ -11,7 +11,7 @@ GEM
|
|
|
11
11
|
public_suffix (>= 2.0.2, < 8.0)
|
|
12
12
|
ansi (1.6.0)
|
|
13
13
|
ast (2.4.3)
|
|
14
|
-
bigdecimal (4.1.
|
|
14
|
+
bigdecimal (4.1.3)
|
|
15
15
|
builder (3.3.0)
|
|
16
16
|
concurrent-ruby (1.3.7)
|
|
17
17
|
crack (1.0.1)
|
|
@@ -66,7 +66,7 @@ GEM
|
|
|
66
66
|
multipart-post (2.4.1)
|
|
67
67
|
net-http (0.9.1)
|
|
68
68
|
uri (>= 0.11.1)
|
|
69
|
-
parallel (2.
|
|
69
|
+
parallel (2.3.0)
|
|
70
70
|
parser (3.3.12.0)
|
|
71
71
|
ast (~> 2.4.1)
|
|
72
72
|
racc
|
|
@@ -75,16 +75,16 @@ GEM
|
|
|
75
75
|
racc (1.8.1)
|
|
76
76
|
rainbow (3.1.1)
|
|
77
77
|
rake (13.4.2)
|
|
78
|
-
regexp_parser (2.
|
|
78
|
+
regexp_parser (2.13.1)
|
|
79
79
|
rexml (3.4.4)
|
|
80
|
-
rubocop (1.
|
|
80
|
+
rubocop (1.92.0)
|
|
81
81
|
json (>= 2.3)
|
|
82
82
|
language_server-protocol (~> 3.17.0.2)
|
|
83
83
|
lint_roller (~> 1.1.0)
|
|
84
84
|
parallel (>= 1.10)
|
|
85
85
|
parser (>= 3.3.0.2)
|
|
86
86
|
rainbow (>= 2.2.2, < 4.0)
|
|
87
|
-
regexp_parser (>= 2.
|
|
87
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
88
88
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
89
89
|
ruby-progressbar (~> 1.7)
|
|
90
90
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
@@ -94,9 +94,9 @@ GEM
|
|
|
94
94
|
rubocop-elegant (0.5.1)
|
|
95
95
|
lint_roller (~> 1.1)
|
|
96
96
|
rubocop (~> 1.75)
|
|
97
|
-
rubocop-minitest (0.
|
|
97
|
+
rubocop-minitest (0.41.0)
|
|
98
98
|
lint_roller (~> 1.1)
|
|
99
|
-
rubocop (>= 1.
|
|
99
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
100
100
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
101
101
|
rubocop-performance (1.27.0)
|
|
102
102
|
lint_roller (~> 1.1)
|
|
@@ -120,11 +120,11 @@ GEM
|
|
|
120
120
|
faraday (~> 2.0)
|
|
121
121
|
faraday-multipart (~> 1.0)
|
|
122
122
|
zeitwerk (~> 2.6)
|
|
123
|
-
unicode-display_width (3.
|
|
124
|
-
unicode-emoji (~> 4.
|
|
125
|
-
unicode-emoji (4.
|
|
123
|
+
unicode-display_width (3.3.0)
|
|
124
|
+
unicode-emoji (~> 4.3)
|
|
125
|
+
unicode-emoji (4.3.0)
|
|
126
126
|
uri (1.1.1)
|
|
127
|
-
webmock (3.
|
|
127
|
+
webmock (3.29.0)
|
|
128
128
|
addressable (>= 2.8.0)
|
|
129
129
|
crack (>= 0.3.2)
|
|
130
130
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/README.md
CHANGED
|
@@ -27,8 +27,8 @@ Then, use it like this:
|
|
|
27
27
|
require 'telepost'
|
|
28
28
|
tp = Telepost.new('..token..')
|
|
29
29
|
Thread.start do
|
|
30
|
-
tp.run do |chat, msg|
|
|
31
|
-
tp.post(chat,
|
|
30
|
+
tp.run do |chat, msg, user|
|
|
31
|
+
tp.post(chat, "Thanks for talking to me, @#{user}!")
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
tp.post(12345, 'How are you?', 'How are you doing?')
|
data/lib/telepost.rb
CHANGED
|
@@ -10,8 +10,8 @@ require 'telegram/bot'
|
|
|
10
10
|
#
|
|
11
11
|
# require 'telepost'
|
|
12
12
|
# tp = Telepost.new('... secret token ...')
|
|
13
|
-
# tp.run do |chat, msg|
|
|
14
|
-
# # Reply to the message via tp.post(msg,
|
|
13
|
+
# tp.run do |chat, msg, user|
|
|
14
|
+
# # Reply to the message via tp.post(chat, msg), user is the sender
|
|
15
15
|
# end
|
|
16
16
|
#
|
|
17
17
|
# For more information read
|
|
@@ -82,7 +82,9 @@ class Telepost
|
|
|
82
82
|
# You can run a chat bot to listen to the messages coming to it, in
|
|
83
83
|
# a separate thread.
|
|
84
84
|
#
|
|
85
|
-
# @yield [Integer, String] Yields chat ID
|
|
85
|
+
# @yield [Integer, String, String, nil] Yields chat ID, message text, and
|
|
86
|
+
# sender username, which is +nil+ when the sender has no username or the
|
|
87
|
+
# update has no sender
|
|
86
88
|
# @return [void]
|
|
87
89
|
# @raise [RuntimeError] If no block is given
|
|
88
90
|
def run
|
|
@@ -90,7 +92,11 @@ class Telepost
|
|
|
90
92
|
@bot.listen do |message|
|
|
91
93
|
next unless message.respond_to?(:chat)
|
|
92
94
|
next if message.chat.nil?
|
|
93
|
-
yield(
|
|
95
|
+
yield(
|
|
96
|
+
message.chat.id,
|
|
97
|
+
message.respond_to?(:text) ? message.text : '',
|
|
98
|
+
message.respond_to?(:from) ? message.from&.username : nil
|
|
99
|
+
)
|
|
94
100
|
end
|
|
95
101
|
rescue Net::OpenTimeout
|
|
96
102
|
retry
|
data/telepost.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
|
|
10
10
|
s.required_ruby_version = '>=3.2'
|
|
11
11
|
s.name = 'telepost'
|
|
12
|
-
s.version = '0.
|
|
12
|
+
s.version = '0.11.0'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Simple Telegram posting Ruby gem'
|
|
15
15
|
s.description = 'Simple Telegram posting Ruby gem'
|