telepost 0.9.0 → 0.10.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 +14 -14
- data/README.md +5 -3
- 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: bb2f082807cb2bf827333ccbaf2dbe286b46edd1ddd8518df9628c7507822dc3
|
|
4
|
+
data.tar.gz: bcd93a98a219b978a7673c49746b54dd8240bbbfa51c2a1749fd17d129a96455
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a96040340518bec226b2ff447ac0d784e23785050de3c518c84369f64e265eba8225459d04405de64e2b877529d594f04597f8617689af6331f6d76f56c1d14
|
|
7
|
+
data.tar.gz: a1278e354d65fe8fbc9ae8adcea25ae851e6f10223ccfd735de47b8d39331982191b01b6abf76e79d593f235423d52f591715c3d28b828b78e46f243b3d53de0
|
data/Gemfile.lock
CHANGED
|
@@ -13,7 +13,7 @@ GEM
|
|
|
13
13
|
ast (2.4.3)
|
|
14
14
|
bigdecimal (4.1.2)
|
|
15
15
|
builder (3.3.0)
|
|
16
|
-
concurrent-ruby (1.3.
|
|
16
|
+
concurrent-ruby (1.3.7)
|
|
17
17
|
crack (1.0.1)
|
|
18
18
|
bigdecimal
|
|
19
19
|
rexml
|
|
@@ -41,18 +41,18 @@ GEM
|
|
|
41
41
|
dry-inflector (~> 1.0)
|
|
42
42
|
dry-logic (~> 1.4)
|
|
43
43
|
zeitwerk (~> 2.6)
|
|
44
|
-
faraday (2.14.
|
|
44
|
+
faraday (2.14.3)
|
|
45
45
|
faraday-net_http (>= 2.0, < 3.5)
|
|
46
46
|
json
|
|
47
47
|
logger
|
|
48
48
|
faraday-multipart (1.2.0)
|
|
49
49
|
multipart-post (~> 2.0)
|
|
50
|
-
faraday-net_http (3.4.
|
|
50
|
+
faraday-net_http (3.4.4)
|
|
51
51
|
net-http (~> 0.5)
|
|
52
52
|
hashdiff (1.2.1)
|
|
53
53
|
ice_nine (0.11.2)
|
|
54
|
-
json (2.
|
|
55
|
-
language_server-protocol (3.17.0.
|
|
54
|
+
json (2.21.2)
|
|
55
|
+
language_server-protocol (3.17.0.6)
|
|
56
56
|
lint_roller (1.1.0)
|
|
57
57
|
logger (1.7.0)
|
|
58
58
|
minitest (6.0.6)
|
|
@@ -67,7 +67,7 @@ GEM
|
|
|
67
67
|
net-http (0.9.1)
|
|
68
68
|
uri (>= 0.11.1)
|
|
69
69
|
parallel (2.1.0)
|
|
70
|
-
parser (3.3.
|
|
70
|
+
parser (3.3.12.0)
|
|
71
71
|
ast (~> 2.4.1)
|
|
72
72
|
racc
|
|
73
73
|
prism (1.9.0)
|
|
@@ -77,8 +77,8 @@ GEM
|
|
|
77
77
|
rake (13.4.2)
|
|
78
78
|
regexp_parser (2.12.0)
|
|
79
79
|
rexml (3.4.4)
|
|
80
|
-
rubocop (1.
|
|
81
|
-
json (
|
|
80
|
+
rubocop (1.90.0)
|
|
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)
|
|
@@ -88,19 +88,19 @@ GEM
|
|
|
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)
|
|
91
|
-
rubocop-ast (1.
|
|
91
|
+
rubocop-ast (1.50.0)
|
|
92
92
|
parser (>= 3.3.7.2)
|
|
93
93
|
prism (~> 1.7)
|
|
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.40.0)
|
|
98
98
|
lint_roller (~> 1.1)
|
|
99
99
|
rubocop (>= 1.75.0, < 2.0)
|
|
100
100
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
101
|
-
rubocop-performance (1.
|
|
101
|
+
rubocop-performance (1.27.0)
|
|
102
102
|
lint_roller (~> 1.1)
|
|
103
|
-
rubocop (>= 1.
|
|
103
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
104
104
|
rubocop-ast (>= 1.47.1, < 2.0)
|
|
105
105
|
rubocop-rake (0.7.1)
|
|
106
106
|
lint_roller (~> 1.1)
|
|
@@ -124,11 +124,11 @@ GEM
|
|
|
124
124
|
unicode-emoji (~> 4.1)
|
|
125
125
|
unicode-emoji (4.2.0)
|
|
126
126
|
uri (1.1.1)
|
|
127
|
-
webmock (3.26.
|
|
127
|
+
webmock (3.26.3)
|
|
128
128
|
addressable (>= 2.8.0)
|
|
129
129
|
crack (>= 0.3.2)
|
|
130
130
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
131
|
-
yard (0.9.
|
|
131
|
+
yard (0.9.45)
|
|
132
132
|
zeitwerk (2.8.2)
|
|
133
133
|
|
|
134
134
|
PLATFORMS
|
data/README.md
CHANGED
|
@@ -46,13 +46,15 @@ tp = Telepost.new('..token..', chats: [12345])
|
|
|
46
46
|
tp.spam('How are you?')
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
You can also attach a file
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
You can also attach a file. The `file` argument accepts a path or
|
|
50
|
+
an already-open `IO`/`File`, and `caption:` is optional. A file with
|
|
51
|
+
an image extension goes out as a photo, which Telegram shows inline,
|
|
52
|
+
while everything else goes out as a document:
|
|
52
53
|
|
|
53
54
|
```ruby
|
|
54
55
|
tp = Telepost.new('..token..')
|
|
55
56
|
tp.attach(12345, '/tmp/dump.sql', caption: 'Today is dump')
|
|
57
|
+
tp.attach(12345, '/tmp/chart.png', caption: 'Today is chart')
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
You can also pass an array of files, to post them all as a single
|
data/lib/telepost.rb
CHANGED
|
@@ -121,9 +121,11 @@ class Telepost
|
|
|
121
121
|
@bot.api.send_message(chat_id: chat, parse_mode:, disable_web_page_preview: true, text: lines.join(' '))
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
# Attach a file
|
|
125
|
-
#
|
|
126
|
-
#
|
|
124
|
+
# Attach a file to the chat. The file argument can either be a
|
|
125
|
+
# path (String) or an open IO/File. The filename shown in Telegram
|
|
126
|
+
# comes from the basename of the path. A file with an image
|
|
127
|
+
# extension goes out as a photo via +sendPhoto+, so Telegram shows
|
|
128
|
+
# it inline, and everything else as a document via +sendDocument+.
|
|
127
129
|
#
|
|
128
130
|
# When +file+ is an +Array+, all of its items are posted as a single
|
|
129
131
|
# grouped message (a Telegram "album") via +sendMediaGroup+. Items
|
|
@@ -139,7 +141,11 @@ class Telepost
|
|
|
139
141
|
def attach(chat, file, caption: nil, parse_mode: 'Markdown')
|
|
140
142
|
return album(chat, file, caption:, parse_mode:) if file.is_a?(Array)
|
|
141
143
|
io = upload(file)
|
|
142
|
-
|
|
144
|
+
if photo?(file)
|
|
145
|
+
@bot.api.send_photo(chat_id: chat, photo: io, caption:, parse_mode:)
|
|
146
|
+
else
|
|
147
|
+
@bot.api.send_document(chat_id: chat, document: io, caption:, parse_mode:)
|
|
148
|
+
end
|
|
143
149
|
ensure
|
|
144
150
|
io.close if file.is_a?(String) && io.respond_to?(:close)
|
|
145
151
|
end
|
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.10.0'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Simple Telegram posting Ruby gem'
|
|
15
15
|
s.description = 'Simple Telegram posting Ruby gem'
|