teleruby 1.5.4 → 1.5.5

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +0 -2
  3. data/lib/api/delete_apis.rb +6 -6
  4. data/lib/api/get_apis.rb +22 -16
  5. data/lib/api/nstandard.rb +4 -1
  6. data/lib/api/other_apis.rb +19 -19
  7. data/lib/api/send_apis.rb +17 -17
  8. data/lib/api/set_apis.rb +14 -15
  9. data/lib/core_api.rb +3 -1
  10. data/lib/teleruby.rb +7 -2
  11. data/teleruby.gemspec +1 -1
  12. metadata +3 -53
  13. data/lib/api/all.rb +0 -12
  14. data/lib/objects/all.rb +0 -42
  15. data/lib/teleruby/all_apis.rb +0 -22
  16. data/lib/teleruby/api/delete_apis.rb +0 -58
  17. data/lib/teleruby/api/get_apis.rb +0 -172
  18. data/lib/teleruby/api/nstandard.rb +0 -27
  19. data/lib/teleruby/api/other_apis.rb +0 -241
  20. data/lib/teleruby/api/send_apis.rb +0 -206
  21. data/lib/teleruby/api/set_apis.rb +0 -137
  22. data/lib/teleruby/core_api.rb +0 -52
  23. data/lib/teleruby/objects/all.rb +0 -42
  24. data/lib/teleruby/objects/animation.rb +0 -40
  25. data/lib/teleruby/objects/audio.rb +0 -39
  26. data/lib/teleruby/objects/bot_command.rb +0 -24
  27. data/lib/teleruby/objects/callback_query.rb +0 -66
  28. data/lib/teleruby/objects/chat.rb +0 -164
  29. data/lib/teleruby/objects/chat_member.rb +0 -142
  30. data/lib/teleruby/objects/chat_permissions.rb +0 -59
  31. data/lib/teleruby/objects/chat_photo.rb +0 -37
  32. data/lib/teleruby/objects/chosen_inline_result.rb +0 -45
  33. data/lib/teleruby/objects/contact.rb +0 -37
  34. data/lib/teleruby/objects/dice.rb +0 -21
  35. data/lib/teleruby/objects/document.rb +0 -29
  36. data/lib/teleruby/objects/file.rb +0 -32
  37. data/lib/teleruby/objects/game.rb +0 -65
  38. data/lib/teleruby/objects/inline_query.rb +0 -44
  39. data/lib/teleruby/objects/inlinekeyboardbutton.rb +0 -59
  40. data/lib/teleruby/objects/inlinekeyboardmarkup.rb +0 -31
  41. data/lib/teleruby/objects/location.rb +0 -21
  42. data/lib/teleruby/objects/mask_position.rb +0 -35
  43. data/lib/teleruby/objects/message.rb +0 -400
  44. data/lib/teleruby/objects/message_entity.rb +0 -95
  45. data/lib/teleruby/objects/order_info.rb +0 -36
  46. data/lib/teleruby/objects/photo_size.rb +0 -14
  47. data/lib/teleruby/objects/poll.rb +0 -97
  48. data/lib/teleruby/objects/poll_answer.rb +0 -29
  49. data/lib/teleruby/objects/poll_option.rb +0 -22
  50. data/lib/teleruby/objects/pre_checkout_query.rb +0 -50
  51. data/lib/teleruby/objects/same/common.rb +0 -31
  52. data/lib/teleruby/objects/same/common_2.rb +0 -32
  53. data/lib/teleruby/objects/shipping_address.rb +0 -39
  54. data/lib/teleruby/objects/shipping_query.rb +0 -32
  55. data/lib/teleruby/objects/sticker.rb +0 -59
  56. data/lib/teleruby/objects/update.rb +0 -207
  57. data/lib/teleruby/objects/user.rb +0 -66
  58. data/lib/teleruby/objects/user_profile_photos.rb +0 -36
  59. data/lib/teleruby/objects/venue.rb +0 -40
  60. data/lib/teleruby/objects/video.rb +0 -39
  61. data/lib/teleruby/objects/video_note.rb +0 -50
  62. data/lib/teleruby/objects/voice.rb +0 -20
  63. data/lib/teleruby/version.rb +0 -3
@@ -3,7 +3,6 @@
3
3
 
4
4
  require_relative '../core_api'
5
5
 
6
- ##
7
6
  # Solomon Boloshe(Lee Crey)
8
7
  # Friday, August 21 2020 06:35:33 PM +0300
9
8
 
@@ -14,24 +13,24 @@ module Telegram
14
13
  # in a supergroup promoted by the bot.
15
14
  def set_cutom_title(chat_id, user_id, title)
16
15
  if chat_id.to_i.negative?
17
- raise BadRequestError, 'can\' set custom title for private chat'
16
+ fail BadRequestError, 'can\' set custom title for private chat'
18
17
  end
19
18
  hash = { chat_id: chat_id, user_id: user_id, custom_title: title }
20
19
  response = http_post('setChatAdministratorCustomTitle', hash)
21
20
  unless response.ok # rubocop:disable Style/IfUnlessModifier
22
- raise PermissionError, response.description
21
+ fail PermissionError, response.description
23
22
  end
24
23
  response.result
25
24
  end
26
25
 
27
26
  def set_chat_permissions(chat_id, permissions)
28
27
  unless chat_id.to_i.negative?
29
- raise BadRequestError, 'can\' set permissions for private chat'
28
+ fail BadRequestError, 'can\' set permissions for private chat'
30
29
  end
31
30
  hash = { chat_id: chat_id, permissions: permissions }
32
31
  response = http_post('setChatPermissions', hash)
33
32
  unless response.ok # rubocop:disable Style/IfUnlessModifier
34
- raise PermissionError, response.description
33
+ fail PermissionError, response.description
35
34
  end
36
35
  response.result
37
36
  end
@@ -45,7 +44,7 @@ module Telegram
45
44
  hash = { chat_id: chat_id, photo: file }
46
45
  data = http_post('setChatPhoto', hash)
47
46
  unless data.ok # rubocop:disable Style/IfUnlessModifier
48
- raise PermissionError, data.description
47
+ fail PermissionError, data.description
49
48
  end
50
49
  data.result
51
50
  end
@@ -54,13 +53,13 @@ module Telegram
54
53
  # Titles can't be changed for private chats.
55
54
  def set_chat_title(chat_id, title)
56
55
  unless chat_id.to_i.negative?
57
- raise BadRequestError, 'can\'t set chat title for private'
56
+ fail BadRequestError, 'can\'t set chat title for private'
58
57
  end
59
58
 
60
59
  hash = { chat_id: chat_id, title: title.to_s }
61
60
  data = http_post('setChatTitle', hash)
62
61
  unless data.ok # rubocop:disable Style/IfUnlessModifier
63
- raise PermissionError, data.description
62
+ throw PermissionError, data.description
64
63
  end
65
64
 
66
65
  data.result
@@ -70,13 +69,13 @@ module Telegram
70
69
  # a supergroup or a channel.
71
70
  def set_chat_description(chat_id, description)
72
71
  unless chat_id.to_i.negative?
73
- raise BadRequestError, 'can\'t set description for private chat'
72
+ fail BadRequestError, 'can\'t set description for private chat'
74
73
  end
75
74
 
76
75
  hash = { chat_id: chat_id, description: description }
77
76
  data = http_post('setChatDescription', hash)
78
77
  unless data.ok # rubocop:disable Style/IfUnlessModifier
79
- raise PermissionError, data.description
78
+ fail PermissionError, data.description
80
79
  end
81
80
 
82
81
  data.result
@@ -87,7 +86,7 @@ module Telegram
87
86
  hash = { chat_id: chat_id, set_name: set_name }
88
87
  data = http_post('setChatStickerSet', hash)
89
88
  unless data.ok # rubocop:disable Style/IfUnlessModifier
90
- raise StandardError, data.description
89
+ fail StandardError, data.description
91
90
  end
92
91
  data.result
93
92
  end
@@ -97,7 +96,7 @@ module Telegram
97
96
  hash = { command: command }
98
97
  data = http_post('setMyCommand', hash)
99
98
  unless data.ok # rubocop:disable Style/IfUnlessModifier
100
- raise TokenError, data.description
99
+ fail TokenError, data.description
101
100
  end
102
101
  data.result
103
102
  end
@@ -108,7 +107,7 @@ module Telegram
108
107
  hash = { sticker: sticker, position: position }
109
108
  data = http_post('setStickerPositionInTheSet', hash)
110
109
  unless data.ok # rubocop:disable Style/IfUnlessModifier
111
- raise Error, data.description
110
+ fail Error, data.description
112
111
  end
113
112
  data.result
114
113
  end
@@ -118,13 +117,13 @@ module Telegram
118
117
  hash = { name: name, user_id: user_id }.merge!(params)
119
118
  data = http_post('setStickerSetThumb', hash)
120
119
  unless data.ok # rubocop:disable Style/IfUnlessModifier
121
- raise Error, data.description
120
+ fail Error, data.description
122
121
  end
123
122
  data.result
124
123
  end
125
124
 
126
125
  def set_webhook(url, params = {})
127
- raise NotImplementedError, 'not implemented'
126
+ fail NotImplementedError, 'not implemented'
128
127
  end
129
128
  end
130
129
  end
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'faraday'
4
5
  require 'json'
5
- require_relative 'objects/all'
6
+ require 'require_all'
7
+ require_all 'objects'
6
8
 
7
9
  module Telegram
8
10
  class Error < StandardError; end
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require_relative 'api/all'
3
+ require 'require_all'
4
+ require_all 'api'
4
5
 
5
6
  module Telegram
6
7
  # Telegram CLient(bot)
7
8
  class Client
8
- include AllApis
9
+ include DeleteApis
10
+ include GetApis
11
+ include NonStandard
12
+ include OtherApis
13
+ include SendApis SetApis
9
14
  def initialize(token: )
10
15
  @token = token
11
16
  @last_update = 0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'teleruby'
5
- spec.version = '1.5.4'
5
+ spec.version = '1.5.5'
6
6
  spec.date = '2020-04-16'
7
7
  spec.authors = ['Solomon Boloshe(Gem dave)', 'NTB Bloodbath (Gem maintainer)']
8
8
  spec.email = ['SolomonBoloshe9@gmail.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teleruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solomon Boloshe(Gem dave)
@@ -61,7 +61,6 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE.md
63
63
  - README.md
64
- - lib/api/all.rb
65
64
  - lib/api/delete_apis.rb
66
65
  - lib/api/get_apis.rb
67
66
  - lib/api/nstandard.rb
@@ -69,7 +68,6 @@ files:
69
68
  - lib/api/send_apis.rb
70
69
  - lib/api/set_apis.rb
71
70
  - lib/core_api.rb
72
- - lib/objects/all.rb
73
71
  - lib/objects/animation.rb
74
72
  - lib/objects/audio.rb
75
73
  - lib/objects/bot_command.rb
@@ -110,55 +108,6 @@ files:
110
108
  - lib/objects/video_note.rb
111
109
  - lib/objects/voice.rb
112
110
  - lib/teleruby.rb
113
- - lib/teleruby/all_apis.rb
114
- - lib/teleruby/api/delete_apis.rb
115
- - lib/teleruby/api/get_apis.rb
116
- - lib/teleruby/api/nstandard.rb
117
- - lib/teleruby/api/other_apis.rb
118
- - lib/teleruby/api/send_apis.rb
119
- - lib/teleruby/api/set_apis.rb
120
- - lib/teleruby/core_api.rb
121
- - lib/teleruby/objects/all.rb
122
- - lib/teleruby/objects/animation.rb
123
- - lib/teleruby/objects/audio.rb
124
- - lib/teleruby/objects/bot_command.rb
125
- - lib/teleruby/objects/callback_query.rb
126
- - lib/teleruby/objects/chat.rb
127
- - lib/teleruby/objects/chat_member.rb
128
- - lib/teleruby/objects/chat_permissions.rb
129
- - lib/teleruby/objects/chat_photo.rb
130
- - lib/teleruby/objects/chosen_inline_result.rb
131
- - lib/teleruby/objects/contact.rb
132
- - lib/teleruby/objects/dice.rb
133
- - lib/teleruby/objects/document.rb
134
- - lib/teleruby/objects/file.rb
135
- - lib/teleruby/objects/game.rb
136
- - lib/teleruby/objects/inline_query.rb
137
- - lib/teleruby/objects/inlinekeyboardbutton.rb
138
- - lib/teleruby/objects/inlinekeyboardmarkup.rb
139
- - lib/teleruby/objects/location.rb
140
- - lib/teleruby/objects/mask_position.rb
141
- - lib/teleruby/objects/message.rb
142
- - lib/teleruby/objects/message_entity.rb
143
- - lib/teleruby/objects/order_info.rb
144
- - lib/teleruby/objects/photo_size.rb
145
- - lib/teleruby/objects/poll.rb
146
- - lib/teleruby/objects/poll_answer.rb
147
- - lib/teleruby/objects/poll_option.rb
148
- - lib/teleruby/objects/pre_checkout_query.rb
149
- - lib/teleruby/objects/same/common.rb
150
- - lib/teleruby/objects/same/common_2.rb
151
- - lib/teleruby/objects/shipping_address.rb
152
- - lib/teleruby/objects/shipping_query.rb
153
- - lib/teleruby/objects/sticker.rb
154
- - lib/teleruby/objects/update.rb
155
- - lib/teleruby/objects/user.rb
156
- - lib/teleruby/objects/user_profile_photos.rb
157
- - lib/teleruby/objects/venue.rb
158
- - lib/teleruby/objects/video.rb
159
- - lib/teleruby/objects/video_note.rb
160
- - lib/teleruby/objects/voice.rb
161
- - lib/teleruby/version.rb
162
111
  - msg.png
163
112
  - rdoc.png
164
113
  - teleruby.gemspec
@@ -182,7 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
131
  - !ruby/object:Gem::Version
183
132
  version: '0'
184
133
  requirements: []
185
- rubygems_version: 3.1.2
134
+ rubyforge_project:
135
+ rubygems_version: 2.7.6
186
136
  signing_key:
187
137
  specification_version: 4
188
138
  summary: Simple ruby wrapper for Telegram bot
@@ -1,12 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module Telegram
4
- module AllApis
5
- require_relative 'delete_apis'
6
- require_relative 'get_apis'
7
- require_relative 'nstandard'
8
- require_relative 'other_apis'
9
- require_relative 'send_apis'
10
- require_relative 'set_apis'
11
- end
12
- end
@@ -1,42 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: false
3
-
4
- # :nodoc:
5
-
6
- require_relative 'poll'
7
- require_relative 'location'
8
- require_relative 'venue'
9
- require_relative 'chat'
10
- require_relative 'bot_command'
11
- require_relative 'chat_permissions'
12
- require_relative 'chat_photo'
13
- require_relative 'callback_query'
14
- require_relative 'file'
15
- require_relative 'user_profile_photos'
16
- require_relative 'poll_answer'
17
- require_relative 'poll_option'
18
- require_relative 'dice'
19
- require_relative 'contact'
20
- require_relative 'voice'
21
- require_relative 'video'
22
- require_relative 'audio'
23
- require_relative 'photo_size'
24
- require_relative 'document'
25
- require_relative 'video_note'
26
- require_relative 'user'
27
- require_relative 'message_entity'
28
- require_relative 'chat_member'
29
- require_relative 'update'
30
- require_relative 'chosen_inline_result'
31
- require_relative 'sticker'
32
- require_relative 'game'
33
- require_relative 'inline_query'
34
- require_relative 'shipping_query'
35
- require_relative 'mask_position'
36
- require_relative 'shipping_address'
37
- require_relative 'pre_checkout_query'
38
- require_relative 'order_info'
39
- require_relative 'message'
40
- require_relative 'animation'
41
- require_relative 'inlinekeyboardbutton'
42
- require_relative 'inlinekeyboardmarkup'
@@ -1,22 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: false
3
-
4
- # APIs
5
- require_relative 'api/send_apis'
6
- require_relative 'api/set_apis'
7
- require_relative 'api/delete_apis'
8
- require_relative 'api/other_apis'
9
- require_relative 'api/get_apis'
10
- require_relative 'api/nstandard'
11
-
12
- module Telegram
13
- module AllApis
14
- # directory => api
15
- include SendApis # send_apis.rb
16
- include SetApis # set_apis.rb
17
- include DeleteApis # delete_apis.rb
18
- include OtherApis # other_apis.rb
19
- include GetApis # get_apis.rb
20
- include NonStandard # nstandard.rb
21
- end
22
- end
@@ -1,58 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative '../core_api'
5
-
6
- module Telegram
7
- module DeleteApis
8
- ##
9
- # Use this method to delete a chat photo.
10
- def delete_chat_photo(chat_id)
11
- unless chat_id.to_i.negative?
12
- fail BadRequestError, %{can't delete private chat photo}
13
- end
14
-
15
- hash = { chat_id: chat_id }
16
- response = post('deleteChatPhoto', hash)
17
- unless response.ok # rubocop:disable Style/IfUnlessModifier
18
- fail PermissionError, response.description
19
- end
20
-
21
- response.result
22
- end
23
-
24
- ##
25
- # Use this method to delete a group sticker set from a supergroup.
26
- def delete_chat_sticker_set(chat_id)
27
- unless chat_id.to_i.negative?
28
- fail BadRequestError, %{can' delete sticker set of private chat}
29
- end
30
-
31
- hash = { chat_id: chat_id }
32
- response = post('deleteChatStickerSet', hash)
33
- unless response.ok # rubocop:disable Style/IfUnlessModifier
34
- fail PermissionError, response.description
35
- end
36
-
37
- response.result
38
- end
39
-
40
- ##
41
- # Use this method to delete a message, including service messages.
42
- def delete_message(chat_id, message_id)
43
- hash = { chat_id: chat_id, message_id: message_id }
44
- response = post('deleteMessage', hash)
45
- unless response.ok # rubocop:disable Style/IfUnlessModifier
46
- fail TelegramError, response.description
47
- end
48
-
49
- response.result
50
- end
51
-
52
- ##
53
- # Use this method to delete a sticker from a set created by the bot.
54
- def delete_sticker_from_set(sticker)
55
- throw NotImplementedError, 'currently not supported'
56
- end
57
- end
58
- end
@@ -1,172 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative '../core_api'
5
-
6
- ##
7
- # Solomon Boloshe(Lee Crey)
8
- # Friday, August 21 2020 04:52:49 PM +0300
9
-
10
- module Telegram
11
- module GetApis # rubocop:disable Metrics/ModuleLength
12
- ##
13
- # Use this method to receive incoming updates using long polling.
14
- def get_updates(limit = 10, &block) # rubocop:disable Metrics/MethodLength
15
- blok = {}
16
- if block_given?
17
- blok = block.call
18
- unless blok.instance_of? Hash # rubocop:disable Style/IfUnlessModifier
19
- fail ArgumentError, 'expected object is hash'
20
- end
21
- end
22
-
23
- hash = { 'timeout': 0, 'limit': limit, 'offset': @last_update }
24
- hash.merge!(blok)
25
- response = get('getUpdates', hash)
26
- unless response.ok # rubocop:disable Style/IfUnlessModifier
27
- fail TelegramError, response.desciption
28
- end
29
-
30
- result = response.result
31
- if result.instance_of? Array
32
- @last_update = result.last.update_id + 1 if result.last
33
- end
34
-
35
- updates = []
36
- result.each do |update|
37
- updates << Update.new(update)
38
- end
39
- updates
40
- end
41
- # rubocop:enalbe Metrics/MethodLength
42
-
43
- # A simple method for testing your bot's authentication token.
44
- def get_me
45
- response = get('getMe')
46
- unless response.ok # rubocop:disable Style/IfUnlessModifier
47
- fail TokenError, 'incorrect bot token'
48
- end
49
- BotUser.new(response.result)
50
- end
51
-
52
- # Use this method to get basic info about a file.
53
- # Returns TFile object
54
- def get_file(file_id)
55
- hash = { file_id: file_id }
56
- response = get('getFile', hash)
57
- unless response.ok # rubocop:disable Style/IfUnlessModifier
58
- fail IdError, 'incorrect file id'
59
- end
60
- TFile.new(response.result)
61
- end
62
-
63
- # Use this method to get a list of profile pictures for a user.
64
- def get_profile_photos(user_id, params = {}) # rubocop:disable Metrics/MethodLength
65
- if user_id.to_i.negative? # rubocop:disable Style/IfUnlessModifier
66
- fail IdError, 'id must be private chat\'s id'
67
- end
68
-
69
- hash = { uesr_id: user_id }.merge!(params)
70
- response = get('getProfilePhotos', hash)
71
- unless response.ok # rubocop:disable Style/IfUnlessModifier
72
- fails TelegramError, response.description
73
- end
74
-
75
- result = response.result
76
- if result.instance_of? Array
77
- profile = []
78
- result.each do |e|
79
- profile << ProfilePhoto.new(e)
80
- end
81
- return profile
82
- end
83
- ProfilePhoto.new(result)
84
- end
85
-
86
- ##
87
- # Use this method to get a list of administrators in a chat.
88
- def get_chat_admins(chat_id)
89
- unless chat_id.to_i.negative? # rubocop:disable Style/IfUnlessModifier
90
- fail IdError, 'chat id must be supergroup id'
91
- end
92
- hash = { chat_id: chat_id }
93
- response = get('getChatAdministrators', hash)
94
- unless response.ok # rubocop:disable Style/IfUnlessModifier
95
- fail FatalError, 'fatal error'
96
- end
97
-
98
- result = response.result
99
- users = []
100
- result.each do |user|
101
- users << ChatMember.new(user)
102
- end
103
- users
104
- end
105
- # rubocop:enable Metrics/MethodLength
106
-
107
- ##
108
- # Use this method to get the number of members in a chat.
109
- def get_chat_members_count(chat_id)
110
- hash = { chat_id: chat_id }
111
- response = get('getChatMemebersCount', hash)
112
- unless response.ok # rubocop:disable Style/IfUnlessModifier
113
- raise IdError, %{don't use private chat id}
114
- end
115
- response.result
116
- end
117
-
118
- # Use this method to get information about a member of a chat.
119
- def get_chat_member(chat_id, user_id)
120
- hash = { chat_id: chat_id, user_id: user_id }
121
- response = get('getChatMember', hash)
122
- unless response.ok # rubocop:disable Style/IfUnlessModifier
123
- fail FatalError, response.description
124
- end
125
- ChatMember.new(response.result)
126
- end
127
-
128
- # Use this method to get a sticker set.
129
- def get_sticker_set_name(name)
130
- hash = { name: name }
131
- response = get('getStickerSetName', hash)
132
- unless response.ok # rubocop:disable Style/IfUnlessModifier
133
- fail Error, %{incorrect sticker set name}
134
- end
135
- StickerSet.new(response.result)
136
- end
137
-
138
- ##
139
- # Use this method to get up to date information about the chat.
140
- def get_chat(chat_id) # rubocop:disable Metrics/MethodLength
141
- hash = { chat_id: chat_id }
142
- response = get('getChat', hash)
143
- unless response.ok # rubocop:disable Style/IfUnlessModifier
144
- fail IdError, %{incorrect chat id}
145
- end
146
-
147
- if chat_id.negative?
148
- return GetChat.new(response.result)
149
- end
150
- PrivateChat.new(response.result)
151
- end
152
-
153
- ##
154
- # Use this method to get the current list of the bot's commands.
155
- def get_my_commands # rubocop:disable Metrics/MethodLength
156
- response = get('getMyCommands')
157
- unless response.ok # rubocop:disable Style/IfUnlessModifier
158
- fail TokenError, %{seems bot token error}
159
- end
160
-
161
- commands = []
162
- result = response.result
163
- result.each do |command|
164
- commands << BotCommand.new(command)
165
- end
166
- commands
167
- end
168
- end
169
- # rubocop:enable Metrics/MethodLength
170
-
171
- # The End!
172
- end