telegrammer 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/telegrammer.rb +8 -8
- data/lib/telegrammer/bot.rb +20 -14
- data/lib/telegrammer/data_types/inline_query_result_article.rb +1 -1
- data/lib/telegrammer/data_types/inline_query_result_gif.rb +1 -1
- data/lib/telegrammer/data_types/inline_query_result_mpeg4_gif.rb +1 -1
- data/lib/telegrammer/data_types/inline_query_result_photo.rb +2 -2
- data/lib/telegrammer/data_types/inline_query_result_video.rb +1 -1
- 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: 224d03bc70f9c37278200814817ae37b1540b861
|
4
|
+
data.tar.gz: 643f7ba2ce3150bff36c5adfde1f59733477939a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0399b80941d6235db752b752f21d29d4c48c84e1aaf9d513f3e7d78ea8b18d86f50cb31614914edb4f69b6318ea11168cf05b88819e4e7689f3584fe7ea1f171
|
7
|
+
data.tar.gz: f7cba215caea44098d7bdbca2ff1a616c364fbba6446ed79341f9cd083b3a32012149128eb776eabad113b4202f15781e608c2edd91e3413c989dbb2d5862929
|
data/CHANGELOG.md
CHANGED
data/lib/telegrammer.rb
CHANGED
@@ -15,6 +15,14 @@ require 'telegrammer/data_types/sticker'
|
|
15
15
|
require 'telegrammer/data_types/video'
|
16
16
|
require 'telegrammer/data_types/voice'
|
17
17
|
|
18
|
+
require 'telegrammer/data_types/chosen_inline_result'
|
19
|
+
require 'telegrammer/data_types/inline_query'
|
20
|
+
require 'telegrammer/data_types/inline_query_result_article'
|
21
|
+
require 'telegrammer/data_types/inline_query_result_gif'
|
22
|
+
require 'telegrammer/data_types/inline_query_result_mpeg4_gif'
|
23
|
+
require 'telegrammer/data_types/inline_query_result_photo'
|
24
|
+
require 'telegrammer/data_types/inline_query_result_video'
|
25
|
+
|
18
26
|
require 'telegrammer/data_types/document'
|
19
27
|
require 'telegrammer/data_types/file'
|
20
28
|
require 'telegrammer/data_types/force_reply'
|
@@ -26,14 +34,6 @@ require 'telegrammer/data_types/reply_keyboard_markup'
|
|
26
34
|
require 'telegrammer/data_types/update'
|
27
35
|
require 'telegrammer/data_types/user_profile_photos'
|
28
36
|
|
29
|
-
require 'telegrammer/data_types/chosen_inline_result'
|
30
|
-
require 'telegrammer/data_types/inline_query'
|
31
|
-
require 'telegrammer/data_types/inline_query_result_article'
|
32
|
-
require 'telegrammer/data_types/inline_query_result_gif'
|
33
|
-
require 'telegrammer/data_types/inline_query_result_mpeg4_gif'
|
34
|
-
require 'telegrammer/data_types/inline_query_result_photo'
|
35
|
-
require 'telegrammer/data_types/inline_query_result_video'
|
36
|
-
|
37
37
|
require 'telegrammer/bot'
|
38
38
|
require 'telegrammer/api_response'
|
39
39
|
|
data/lib/telegrammer/bot.rb
CHANGED
@@ -34,17 +34,21 @@ module Telegrammer
|
|
34
34
|
# @example
|
35
35
|
# bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')
|
36
36
|
#
|
37
|
-
# bot.get_updates do |
|
38
|
-
#
|
39
|
-
#
|
37
|
+
# bot.get_updates do |update|
|
38
|
+
# if update.is_a?(Telegrammer::DataTypes::Message)
|
39
|
+
# puts "In chat #{update.chat.id}, @#{update.from.username} said: #{update.text}"
|
40
|
+
# bot.send_message(chat_id: update.chat.id, text: "You said: #{update.text}")
|
41
|
+
# end
|
40
42
|
#
|
41
43
|
# # Here you can also process message text to detect user commands
|
42
44
|
# # To learn more about commands, see https://core.telegram.org/bots#commands
|
43
45
|
# end
|
44
46
|
#
|
45
47
|
# bot.get_updates({fail_silently:true, timeout:20}) do |message|
|
46
|
-
#
|
47
|
-
#
|
48
|
+
# if update.is_a?(Telegrammer::DataTypes::Message)
|
49
|
+
# puts "In chat #{message.chat.id}, @#{message.from.username} said: #{update.text}"
|
50
|
+
# bot.send_message(chat_id: message.chat.id, text: "You said: #{update.text}")
|
51
|
+
# end
|
48
52
|
#
|
49
53
|
# # Here you can also process message text to detect user commands
|
50
54
|
# # To learn more about commands, see https://core.telegram.org/bots#commands
|
@@ -64,7 +68,7 @@ module Telegrammer
|
|
64
68
|
response.result.each do |raw_update|
|
65
69
|
update = Telegrammer::DataTypes::Update.new(raw_update)
|
66
70
|
@offset = update.update_id + 1
|
67
|
-
yield update.message
|
71
|
+
yield (update.inline_query ? update.inline_query : update.message)
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
@@ -462,16 +466,18 @@ module Telegrammer
|
|
462
466
|
# @example
|
463
467
|
# bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')
|
464
468
|
#
|
465
|
-
# bot.get_updates do |
|
466
|
-
#
|
469
|
+
# bot.get_updates do |update|
|
470
|
+
# if update.is_a?(Telegrammer::DataTypes::InlineQuery)
|
471
|
+
# inline_query = message.inline_query
|
467
472
|
#
|
468
|
-
#
|
469
|
-
#
|
473
|
+
# if inline_query
|
474
|
+
# results = the_search_in_my_app(inline_query.query)
|
470
475
|
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
#
|
474
|
-
#
|
476
|
+
# bot.answer_inline_query(
|
477
|
+
# inline_query_id: "my-internal-query-id",
|
478
|
+
# results: results
|
479
|
+
# )
|
480
|
+
# end
|
475
481
|
# end
|
476
482
|
# end
|
477
483
|
|
@@ -17,7 +17,7 @@ module Telegrammer
|
|
17
17
|
#
|
18
18
|
# See more at https://core.telegram.org/bots/api#inlinequeryresultarticle
|
19
19
|
class InlineQueryResultArticle < Telegrammer::DataTypes::Base
|
20
|
-
attribute :type, String
|
20
|
+
attribute :type, String, default: 'article'
|
21
21
|
attribute :id, String
|
22
22
|
attribute :title, String
|
23
23
|
attribute :message_text, String
|
@@ -16,7 +16,7 @@ module Telegrammer
|
|
16
16
|
#
|
17
17
|
# See more at https://core.telegram.org/bots/api#inlinequeryresultgif
|
18
18
|
class InlineQueryResultGif < Telegrammer::DataTypes::Base
|
19
|
-
attribute :type, String
|
19
|
+
attribute :type, String, default: 'gif'
|
20
20
|
attribute :id, String
|
21
21
|
attribute :gif_url, String
|
22
22
|
attribute :gif_width, Integer
|
@@ -16,7 +16,7 @@ module Telegrammer
|
|
16
16
|
#
|
17
17
|
# See more at https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
|
18
18
|
class InlineQueryResultMpeg4Gif < Telegrammer::DataTypes::Base
|
19
|
-
attribute :type, String
|
19
|
+
attribute :type, String, default: 'mpeg4_gif'
|
20
20
|
attribute :id, String
|
21
21
|
attribute :mpeg4_url, String
|
22
22
|
attribute :mpeg4_width, Integer
|
@@ -2,7 +2,7 @@ module Telegrammer
|
|
2
2
|
module DataTypes
|
3
3
|
# Telegram InlineQueryResultPhoto data type
|
4
4
|
#
|
5
|
-
# @attr [String] type Type of the result, must be
|
5
|
+
# @attr [String] type Type of the result, must be photo
|
6
6
|
# @attr [String] id Unique identifier for this result, 1-64 Bytes
|
7
7
|
# @attr [String] photo_url A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
|
8
8
|
# @attr [Integer] photo_width Optional. Width of the photo
|
@@ -17,7 +17,7 @@ module Telegrammer
|
|
17
17
|
#
|
18
18
|
# See more at https://core.telegram.org/bots/api#inlinequeryresultphoto
|
19
19
|
class InlineQueryResultPhoto < Telegrammer::DataTypes::Base
|
20
|
-
attribute :type, String
|
20
|
+
attribute :type, String, default: 'photo'
|
21
21
|
attribute :id, String
|
22
22
|
attribute :photo_url, String
|
23
23
|
attribute :photo_width, Integer
|
@@ -18,7 +18,7 @@ module Telegrammer
|
|
18
18
|
#
|
19
19
|
# See more at https://core.telegram.org/bots/api#inlinequeryresultvideo
|
20
20
|
class InlineQueryResultVideo < Telegrammer::DataTypes::Base
|
21
|
-
attribute :type, String
|
21
|
+
attribute :type, String, default: 'video'
|
22
22
|
attribute :id, String
|
23
23
|
attribute :video_url, String
|
24
24
|
attribute :mime_type, String
|
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.7.
|
4
|
+
version: 0.7.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: 2016-01-
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.5
|
147
|
+
rubygems_version: 2.4.5
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Ruby client for the Telegram's Bots API
|