telegrammer 0.6.0 → 0.6.1
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/CHANGELOG.md +6 -0
- data/lib/telegrammer/bot.rb +17 -19
- data/lib/telegrammer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 725b61fa8cb25386f77232d48030a47982aaefd4
|
4
|
+
data.tar.gz: 8e50940cb2f539cbcf616b164921e610d7e353cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470585dd3ee07e23b45857582b4e2393fbbbd9c385bd1166b9a75c0a83b9478a8122442148c7b5052a3b57615ef922e0554ce7a209f0f70bcca15e16e6e9c4f6
|
7
|
+
data.tar.gz: 6d8ba416eefc3c4ca4717903f3dcb2834d440ac9d04115750c9ae42faf0b0fec43b8ecee0ec6b0b316ec8238f70779b77a2b2f9c89ee744c432c7d34964e37ca
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
v0.6.1
|
2
|
+
======
|
3
|
+
|
4
|
+
* Updated operations that are using chat_id to also support "@channel" format (reported by @rkpasia in #15).
|
5
|
+
|
1
6
|
v0.6.0
|
2
7
|
======
|
3
8
|
|
4
9
|
* New File & Chat datatypes.
|
5
10
|
* Implemented get_file operation.
|
11
|
+
* Gem is now up to date with API version 2015-10-08 (https://core.telegram.org/bots/api-changelog#october-8-2015).
|
6
12
|
|
7
13
|
v0.5.1
|
8
14
|
======
|
data/lib/telegrammer/bot.rb
CHANGED
@@ -110,7 +110,7 @@ module Telegrammer
|
|
110
110
|
# Send text messages to a user or group chat.
|
111
111
|
#
|
112
112
|
# @param [Hash] params hash of paramers to send to the sendMessage API operation.
|
113
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
113
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
114
114
|
# @option params [String] :text Required. Text of the message to be sent
|
115
115
|
# @option params [String] :parse_mode Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
|
116
116
|
# @option params [Boolean] :disable_web_page_preview Optional. Disables link previews for links in this message
|
@@ -142,8 +142,8 @@ module Telegrammer
|
|
142
142
|
# Forward message to a user or group chat.
|
143
143
|
#
|
144
144
|
# @param [Hash] params hash of paramers to send to the forwardMessage API operation.
|
145
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
146
|
-
# @option params [Integer] :from_chat_id Required. Unique identifier for the chat where the original message was sent.
|
145
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
146
|
+
# @option params [Integer,String] :from_chat_id Required. Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername).
|
147
147
|
# @option params [Integer] :message_id Required. Message id to be forwarded.
|
148
148
|
#
|
149
149
|
# @example
|
@@ -174,7 +174,7 @@ module Telegrammer
|
|
174
174
|
# Sends a photo to a user or group chat.
|
175
175
|
#
|
176
176
|
# @param [Hash] params hash of paramers to send to the sendPhoto API operation.
|
177
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
177
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
178
178
|
# @option params [File,String] :photo Required. Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
|
179
179
|
# @option params [String] :caption Optional. Photo caption (may also be used when resending photos by file_id).
|
180
180
|
# @option params [Integer] :reply_to_message_id Optional. If the message is a reply, ID of the original message
|
@@ -204,7 +204,7 @@ module Telegrammer
|
|
204
204
|
# At this moment, Telegram only allows Ogg files encoded with the OPUS codec. If you need to send another file format, you must use #send_document.
|
205
205
|
#
|
206
206
|
# @param [Hash] params hash of paramers to send to the sendAudio API operation.
|
207
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
207
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
208
208
|
# @option params [File,String] audio Required. Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data
|
209
209
|
# @option params [Integer] duration Optional. Duration of the audio in seconds.
|
210
210
|
# @option params [String] performer Optional. Performer.
|
@@ -238,7 +238,7 @@ module Telegrammer
|
|
238
238
|
# At this moment, Telegram only allows Ogg files encoded with the OPUS codec. If you need to send another file format, you must use #send_document.
|
239
239
|
#
|
240
240
|
# @param [Hash] params hash of paramers to send to the sendAudio API operation.
|
241
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
241
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
242
242
|
# @option params [File,String] voice Required. Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data
|
243
243
|
# @option params [Integer] duration Optional. Duration of sent audio in seconds.
|
244
244
|
# @option params [Integer] :reply_to_message_id Optional. If the message is a reply, ID of the original message
|
@@ -267,7 +267,7 @@ module Telegrammer
|
|
267
267
|
# Sends a document to a user or group chat.
|
268
268
|
#
|
269
269
|
# @param [Hash] params hash of paramers to send to the sendDocument API operation.
|
270
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
270
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
271
271
|
# @option params [File,String] :document Required. File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
|
272
272
|
# @option params [Integer] :reply_to_message_id Optional. If the message is a reply, ID of the original message
|
273
273
|
# @option params [Telegrammer::DataTypes::ReplyKeyboardMarkup,Telegrammer::DataTypes::ReplyKeyboardHide,Telegrammer::DataTypes::ForceReply] :reply_markup Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
|
@@ -292,7 +292,7 @@ module Telegrammer
|
|
292
292
|
# Send WebP images as stickers.
|
293
293
|
#
|
294
294
|
# @param [Hash] params hash of paramers to send to the sendSticker API operation.
|
295
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
295
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
296
296
|
# @option params [File,String] :sticker Required. Sticker to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
|
297
297
|
# @option params [Integer] :reply_to_message_id Optional. If the message is a reply, ID of the original message
|
298
298
|
# @option params [Telegrammer::DataTypes::ReplyKeyboardMarkup,Telegrammer::DataTypes::ReplyKeyboardHide,Telegrammer::DataTypes::ForceReply] :reply_markup Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
|
@@ -320,7 +320,7 @@ module Telegrammer
|
|
320
320
|
# At this moment, Telegram only support mp4 videos. If you need to send other formats you must use #send_document.
|
321
321
|
#
|
322
322
|
# @param [Hash] params hash of paramers to send to the sendVideo API operation.
|
323
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
323
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
324
324
|
# @option params [File,String] :video Required. Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file.
|
325
325
|
# @option params [Integer] :duration Optional. Duration of sent video in seconds.
|
326
326
|
# @option params [String] :caption Optional. Video caption (may also be used when resending videos by file_id).
|
@@ -350,7 +350,7 @@ module Telegrammer
|
|
350
350
|
# Sends point on the map to a user or group chat.
|
351
351
|
#
|
352
352
|
# @param [Hash] params hash of paramers to send to the sendAudio API operation.
|
353
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
353
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
354
354
|
# @option params [Float] :latitude Required. Latitude of location.
|
355
355
|
# @option params [Float] :longitude Required. Longitude of location.
|
356
356
|
# @option params [Integer] :reply_to_message_id Optional. If the message is a reply, ID of the original message.
|
@@ -378,7 +378,7 @@ module Telegrammer
|
|
378
378
|
# Used when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
|
379
379
|
#
|
380
380
|
# @param [Hash] params hash of paramers to send to the sendChatAction API operation.
|
381
|
-
# @option params [Integer] :chat_id Required. Unique identifier for the
|
381
|
+
# @option params [Integer,String] :chat_id Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).
|
382
382
|
# @option params [String] :action Required. Type of action to broadcast. Choose one, depending on what the user is about to receive: "typing" for text messages, "upload_photo" for photos, "record_video" or "upload_video" for videos, "record_audio" or "upload_audio" for audio files, "upload_document" for general files, "find_location" for location data.
|
383
383
|
#
|
384
384
|
# @example
|
@@ -391,7 +391,7 @@ module Telegrammer
|
|
391
391
|
# @return [Telegrammer::ApiResponse] Response from the API.
|
392
392
|
def send_chat_action(params)
|
393
393
|
params_validation = {
|
394
|
-
chat_id: { required: true, class: [Fixnum] },
|
394
|
+
chat_id: { required: true, class: [Fixnum, String] },
|
395
395
|
action: { required: true, class: [String] }
|
396
396
|
}
|
397
397
|
|
@@ -425,12 +425,10 @@ module Telegrammer
|
|
425
425
|
Telegrammer::DataTypes::UserProfilePhotos.new(response.result)
|
426
426
|
end
|
427
427
|
|
428
|
-
# Get a
|
428
|
+
# Get basic info about a file and prepare it for downloading.
|
429
429
|
#
|
430
|
-
# @param [Hash] params hash of paramers to send to the
|
431
|
-
# @option params [
|
432
|
-
# @option params [Integer] :offset Optional. Sequential number of the first photo to be returned. By default, all photos are returned.
|
433
|
-
# @option params [Integer] :limit Optional. Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
|
430
|
+
# @param [Hash] params hash of paramers to send to the getFile API operation.
|
431
|
+
# @option params [String] :file_id Required. File identifier to get info about.
|
434
432
|
#
|
435
433
|
# @example
|
436
434
|
# bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')
|
@@ -448,7 +446,7 @@ module Telegrammer
|
|
448
446
|
response = response = api_request("getFile", params, params_validation)
|
449
447
|
file_object = Telegrammer::DataTypes::File.new(response.result)
|
450
448
|
|
451
|
-
"
|
449
|
+
"#{API_ENDPOINT}/file/bot#{@api_token}/#{file_object.file_path}"
|
452
450
|
end
|
453
451
|
|
454
452
|
private
|
@@ -503,7 +501,7 @@ module Telegrammer
|
|
503
501
|
|
504
502
|
def send_something(object_kind, params, extra_params_validation = {})
|
505
503
|
params_validation = {
|
506
|
-
chat_id: { required: true, class: [Fixnum] },
|
504
|
+
chat_id: { required: true, class: [Fixnum, String] },
|
507
505
|
reply_to_message_id: { required: false, class: [String] },
|
508
506
|
reply_markup: { required: false, class: [
|
509
507
|
Telegrammer::DataTypes::ReplyKeyboardMarkup,
|
data/lib/telegrammer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegrammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Mayoral
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.6
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Ruby client for the Telegram's Bots API
|