telepost 0.1.0 → 0.2.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/.travis.yml +1 -1
- data/README.md +5 -3
- data/lib/telepost.rb +14 -5
- data/telepost.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f0360cb45f6d5abf53b648426caf61f8c4b05189a732b69285b80fa72a9a391
|
4
|
+
data.tar.gz: b58854a54ed8641963808b22922abd1228013eca6b676efe3a8e722877083746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4952e2ff2de28cd7d6d45a095d8b3de38de1e8eac6456237064a1ad5acb5b03304586dd8392ea16361274a0f442ddcba4a66e446bf06c5ea773bbc085f8fc57b
|
7
|
+
data.tar.gz: bb10d98baf1c103a71b773332b78023468ecc04238831d8965e29bca3d2583469d586d6ca396585eecb9410b10d791ee7b5754e17ce8deaa3e81279327f1a73d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
[](https://travis-ci.org/yegor256/telepost)
|
6
6
|
[](http://badge.fury.io/rb/telepost)
|
7
|
-
[](https://codeclimate.com/github/yegor256/telepost/maintainability)
|
8
8
|
[](http://rubydoc.info/github/yegor256/telepost/master/frames)
|
9
9
|
|
10
10
|
Telepost is a simple gateway to Telegram, which can post messages and respond to primitive requests.
|
@@ -21,8 +21,10 @@ Then, use it like this:
|
|
21
21
|
require 'telepost'
|
22
22
|
require 'logger'
|
23
23
|
tp = Telepost.new('..token..')
|
24
|
-
|
25
|
-
tp.
|
24
|
+
Thread.start do
|
25
|
+
tp.run do |chat, msg|
|
26
|
+
tp.post(chat: chat, 'Thanks for talking to me!')
|
27
|
+
end
|
26
28
|
end
|
27
29
|
tp.post(chat: 12345, 'How are you?', 'How are you doing?')
|
28
30
|
```
|
data/lib/telepost.rb
CHANGED
@@ -51,15 +51,19 @@ class Telepost
|
|
51
51
|
# Nothing to do here
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def spam(*lines)
|
55
|
+
post(0, lines)
|
56
|
+
end
|
57
|
+
|
58
|
+
def post(chat, *lines)
|
55
59
|
@sent << "#{chat}: #{lines.join(' ')}"
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
59
|
-
def initialize(token,
|
63
|
+
def initialize(token, chats: [])
|
60
64
|
@token = token
|
61
65
|
@client = Telebot::Client.new(token)
|
62
|
-
@
|
66
|
+
@chats = chats
|
63
67
|
end
|
64
68
|
|
65
69
|
def run
|
@@ -75,8 +79,13 @@ class Telepost
|
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
78
|
-
def
|
79
|
-
|
82
|
+
def spam(*lines)
|
83
|
+
@chats.each do |chat|
|
84
|
+
post(chat, lines)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def post(chat, *lines)
|
80
89
|
@client.send_message(
|
81
90
|
chat_id: chat,
|
82
91
|
parse_mode: 'Markdown',
|
data/telepost.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.rubygems_version = '2.5.1'
|
32
32
|
s.required_ruby_version = '>=2.5'
|
33
33
|
s.name = 'telepost'
|
34
|
-
s.version = '0.
|
34
|
+
s.version = '0.2.0'
|
35
35
|
s.license = 'MIT'
|
36
36
|
s.summary = 'Simple Telegram posting Ruby gem'
|
37
37
|
s.description = 'Simple Telegram posting Ruby gem'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telepost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: telebot
|