icqbot 0.1.4 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26bf462455d95a0c0600e9ed437593f5c485c639de150ffff76e61cf2ba7aea0
4
- data.tar.gz: 34c3ba04a5eb8acb1ec7ba17e04e29e9515802c21650451be8b00afe9ff9a816
3
+ metadata.gz: 2c8f903bddb535995d723b2bb17ad4a1a2cd0856a053284ae4f66c2dd72ac163
4
+ data.tar.gz: b44c70c7cc4536f6093b2909a6c535f24ff3e19d47ea20d9d08d86f23eab9e98
5
5
  SHA512:
6
- metadata.gz: 404007e2c5bfb54e00ac84d4f4fed67ea79d0f764a007209110e58cc42198ebfc6daa32bd439496090ead2fee0f700886fb12971c57f77121f9fcb04b6642dc1
7
- data.tar.gz: f5c46e086eb0289f47e38dc584375c6a654c1fde431aaac12de6027acb5560059dc6377c75c726f904e384c669f4d24c350e977dd0d5668ff6271169eb2a5e02
6
+ metadata.gz: 76ff8bbf9f9c7d669c29fe6b365d9edbf047ea3883ccfe8069155def240a19043458e96c1957fd6d1f7ef69f08ce92f2a3833ec1f86972dcb875417e8668ee7b
7
+ data.tar.gz: 1e0fa65eeacc00d35fdcd3bf69de542090a433e743898ecf631cbebde75cb52c4434bb51d28ab34fc3bea444e01ac07b1cefca1d4974001e632866a383652452
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .bundle
2
2
  test
3
- Gemfile.lock
3
+ Gemfile.lock
4
+ *.gem
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- icq-bot-ruby in working :zzz:
2
+ icq-bot-ruby :diamonds:
3
3
  ------------
4
4
  Ruby wrapper for [ICQ Bot API](https://icq.com/botapi/)
5
5
 
@@ -21,6 +21,7 @@ ICQ::Bot.new('token') do |bot|
21
21
  end
22
22
  end
23
23
  ```
24
+ more examples in `bin/`
24
25
 
25
26
  ## Docs
26
27
  * **[Documentation](./doc/overview.md)**
data/doc/bot.md CHANGED
@@ -107,4 +107,19 @@ def pin_msg msg_id, chat_id # -> Hash
107
107
  def unpin_msg msg_id, chat_id # -> Hash
108
108
  ```
109
109
  1. `msg_id` - ID сообщения, что нужно открепить.
110
- 2. `chat_id` - ID чата.
110
+ 2. `chat_id` - ID чата.
111
+
112
+ ## Забанить участника
113
+ ```ruby
114
+ def block_user user_id, chat_id, del_last_msg=false # -> Hash
115
+ ```
116
+ 1. `user_id` - ID пользователя, который должен отлететь в бан.
117
+ 2. `chat_id` - ID чата, где забанят.
118
+ 3. `del_last_msg` - удалить или нет последние сообщение пользователя.
119
+
120
+ ## Разбанить участника
121
+ ```ruby
122
+ def unblock_user user_id, chat_id # -> Hash
123
+ ```
124
+ 1. `user_id` - ID пользователя, который должен вернуться из бана.
125
+ 2. `chat_id` - ID чата, где разабанят.
@@ -16,7 +16,7 @@ def initialize text, *keyboard
16
16
  ```ruby
17
17
  attr_reader :text, :keyboard
18
18
  msg.text # текст сообщения(String)
19
- msg.keyboard # массив объектов [Button](./button.md)
19
+ msg.keyboard # массив объектов Button
20
20
  ```
21
21
 
22
22
  ## Добавить кнопку
@@ -0,0 +1,6 @@
1
+
2
+ **TODO**
3
+ * works with files
4
+ * fix callback events
5
+ * fix messages
6
+ * write doc
@@ -6,5 +6,5 @@ require_relative './icqbot/user.rb'
6
6
  require_relative './icqbot/message.rb'
7
7
 
8
8
  module ICQ
9
- VERSION = '0.1.4'
9
+ VERSION = '0.1.5'
10
10
  end
@@ -13,7 +13,7 @@ require_relative './functional/chats/administration/set_title.rb'
13
13
  require_relative './functional/chats/administration/set_about.rb'
14
14
  require_relative './functional/chats/administration/set_rules.rb'
15
15
  require_relative './functional/chats/administration/pin_unpin_msg.rb'
16
-
16
+ require_relative './functional/chats/administration/block_unblock_user.rb'
17
17
 
18
18
  module ICQ
19
19
 
@@ -0,0 +1,27 @@
1
+ require_relative '../../../bot.rb'
2
+
3
+ module ICQ
4
+
5
+ class Bot
6
+ def block_user user_id, chat_id, del_last_msg=false
7
+ params = base_req_for_block_unblock_user user_id, chat_id, del_last_msg
8
+ JSON::load Requests.get(
9
+ URLS_API::BLOCK_USER, params: params).body
10
+ end
11
+
12
+ def unblock_user user_id, chat_id
13
+ params = base_req_for_block_unblock_user user_id, chat_id
14
+ JSON::load Requests.get(
15
+ URLS_API::UNBLOCK_USER, params: params).body
16
+ end
17
+
18
+ private
19
+ def base_req_for_block_unblock_user user_id, chat_id, del_last_msg=nil
20
+ params = base_req chat_id
21
+ params['userId'] = user_id
22
+ params['delLastMessages'] = del_last_msg if del_last_msg
23
+ return params
24
+ end
25
+ end
26
+
27
+ end
@@ -12,5 +12,7 @@ module URLS_API
12
12
  SET_ABOUT = 'https://api.icq.net/bot/v1/chats/setAbout'
13
13
  SET_RULES = 'https://api.icq.net/bot/v1/chats/setRules'
14
14
  PIN_MSG = 'https://api.icq.net/bot/v1​/chats​/pinMessage'
15
- UNPIN_MSG = 'https://api.icq.net/bot/v1​/chats​/unpinMessage'
15
+ UNPIN_MSG = 'https://api.icq.net/bot/v1​/chats​/unpinMessage'
16
+ BLOCK_USER = 'https://api.icq.net/bot/v1​/chats/blockUser'
17
+ UNBLOCK_USER = 'https://api.icq.net/bot/v1​/chats/unblockUser'
16
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icqbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sheyber
@@ -48,11 +48,12 @@ files:
48
48
  - doc/event.md
49
49
  - doc/message.md
50
50
  - doc/overview.md
51
- - doc/user.md
51
+ - doc/todolist.md
52
52
  - icqbot.gemspec
53
53
  - lib/icqbot.rb
54
54
  - lib/icqbot/bot.rb
55
55
  - lib/icqbot/event.rb
56
+ - lib/icqbot/functional/chats/administration/block_unblock_user.rb
56
57
  - lib/icqbot/functional/chats/administration/pin_unpin_msg.rb
57
58
  - lib/icqbot/functional/chats/administration/set_about.rb
58
59
  - lib/icqbot/functional/chats/administration/set_rules.rb
@@ -1,6 +0,0 @@
1
- Bot
2
- ---
3
-
4
- File: `lib/icqbot/user.rb`
5
-
6
- ---