telegramAPI 1.3 → 1.4
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/README.md +29 -0
- data/lib/telegramAPI.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 684b5fd88fee26231c13ef2ed533e986eae68467
|
4
|
+
data.tar.gz: 8488e7e71c45824a544fd3924ee889d59c3975ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53a87c1362d916cc76b7f811b189219935e896148c66324ad78491a0e1fab38da17f9ba7c8932ed937b515d3fc0c48479279c78f4b828bb379da827db2eab251
|
7
|
+
data.tar.gz: 81d82dff9a3310d46ffd0a35f8827f7e9f950db66025892786695d9f965faf838cd0b9cb579faf8e2b7b781c451db3197ced6be7abcf55ca5db84feb4901bfb8
|
data/README.md
CHANGED
@@ -174,3 +174,32 @@ markup = {
|
|
174
174
|
api.sendMessage m['message']['chat']['id'], "Am I sexy?", {"reply_markup"=>markup}
|
175
175
|
```
|
176
176
|
|
177
|
+
### Answer to inline query
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
while true do
|
181
|
+
updates = api.getUpdates({:timeout=>180})
|
182
|
+
updates.each do |u|
|
183
|
+
if(u['inline_query']!=nil) then
|
184
|
+
r = api.answerInlineQuery(u['inline_query']['id'], [
|
185
|
+
{
|
186
|
+
:type=>'article',
|
187
|
+
:id=>"1",
|
188
|
+
:title=>"Test 1",
|
189
|
+
:input_message_content=>{:message_text=>"test content 1"}
|
190
|
+
},{
|
191
|
+
:type=>'article',
|
192
|
+
:id=>"2",
|
193
|
+
:title=>"Test 2",
|
194
|
+
:input_message_content=>{:message_text=>"test content 2"}
|
195
|
+
},{
|
196
|
+
:type=>'article',
|
197
|
+
:id=>"3",
|
198
|
+
:title=>"Test 3",
|
199
|
+
:input_message_content=>{:message_text=>"test content 3"}
|
200
|
+
}
|
201
|
+
])
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
```
|
data/lib/telegramAPI.rb
CHANGED
@@ -27,6 +27,7 @@ class TelegramAPI
|
|
27
27
|
def query api, params={}
|
28
28
|
r = JSON.parse(RestClient.post(@@core+@token+"/"+api, params).body)
|
29
29
|
if r['result'].class==Array and r['result'][-1]!=nil then @last_update=r['result'][-1]['update_id']+1 end
|
30
|
+
p r
|
30
31
|
return r["result"]
|
31
32
|
end
|
32
33
|
|
@@ -137,6 +138,10 @@ class TelegramAPI
|
|
137
138
|
def getChatMember chat_id, user_id
|
138
139
|
self.query("getChatMember", {:chat_id=>chat_id, :user_id=>user_id})
|
139
140
|
end
|
141
|
+
|
142
|
+
def answerInlineQuery inline_query_id, results
|
143
|
+
self.query("answerInlineQuery", {:inline_query_id=>inline_query_id, :results=>JSON.dump(results)})
|
144
|
+
end
|
140
145
|
|
141
146
|
protected :query, :parse_hash, :post
|
142
147
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegramAPI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benedetto Nespoli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|