matrix_qq 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f642d75884d0080c8542aac636f8097e13f4449
4
- data.tar.gz: 8890be89c8220f909c6b1a72f8124c719c1c3b54
3
+ metadata.gz: 1e61154cb00e705ad921de03fa1a32bbb5b19d9a
4
+ data.tar.gz: 9085b054cf9fa51f22b6af337e2b97daab297e9b
5
5
  SHA512:
6
- metadata.gz: 779d66014db5d389580986a968b204718a697fa92238855ef40c1501bab3e14a65d647cdf195e0904c1bc867e56687781a85b32642cff1eaa21755cf3c933e3f
7
- data.tar.gz: 980117f31495667174a72ebe9a47a21e4ebfc15bb39c99578933c80fe824b9325266c81f0fb49391ae9a547c265d5969e9ad607788acdf5a6b89722113cd5dd2
6
+ metadata.gz: cefad07a924d4fb4a49b893e13c21c1f870ebae6603a2a7628ddc2fb6898c9ccfaaf1bdcd4744249d2ebddf2f6a2861b5ebb21af96f6883e9a4af616ff081df2
7
+ data.tar.gz: caadc20d7848d5b74bb55dbdba11045a6eaa9a8325b60d9efa99540ea6dd56a78181695d4eb315ad395def0e163907bfa9ee5103b07df3b63a551096f858f317
data/CHANGELOG.yaml CHANGED
@@ -1,5 +1,12 @@
1
1
  # Notice: Incompatible items start with `!`
2
- 0.2.1:
2
+
3
+ 0.3.2:
4
+ Feature:
5
+ - Emoji support
6
+ 0.3.1:
7
+ Fix:
8
+ - require 'matrix/utils'
9
+ 0.3.0:
3
10
  Feature:
4
11
  - Matrix send message will add forword parm
5
12
  - CQ code parse
@@ -9,6 +16,11 @@
9
16
  - Start/End with uuid
10
17
  - One step json parse
11
18
  - move log to utils
19
+ Delete:
20
+ - lock ignore list
21
+ 0.2.1:
22
+ Feature:
23
+ - will lock ignore list
12
24
  0.2.0:
13
25
  Change:
14
26
  - ! config file add `.rb`
@@ -3,6 +3,35 @@ module MatrixQQ
3
3
  class Forward
4
4
  # send to qq group
5
5
  class Group
6
+ Emoji = [
7
+ *(0x0080..0x02AF),
8
+ *(0x0300..0x03FF),
9
+ *(0x0600..0x06FF),
10
+ *(0x0C00..0x0C7F),
11
+ *(0x1DC0..0x1DFF),
12
+ *(0x1E00..0x1EFF),
13
+ *(0x2000..0x209F),
14
+ *(0x20D0..0x214F),
15
+ *(0x2190..0x23FF),
16
+ *(0x2460..0x25FF),
17
+ *(0x2600..0x27EF),
18
+ *(0x2900..0x29FF),
19
+ *(0x2B00..0x2BFF),
20
+ *(0x2C60..0x2C7F),
21
+ *(0x2E00..0x2E7F),
22
+ *(0x3000..0x303F),
23
+ *(0xA490..0xA4CF),
24
+ *(0xE000..0xF8FF),
25
+ *(0xFE00..0xFE0F),
26
+ *(0xFE30..0xFE4F),
27
+ *(0x1F000..0x1F02F),
28
+ *(0x1F0A0..0x1F0FF),
29
+ *(0x1F100..0x1F64F),
30
+ *(0x1F680..0x1F6FF),
31
+ *(0x1F910..0x1F96B),
32
+ *(0x1F980..0x1F9E0)
33
+ ].freeze
34
+
6
35
  def initialize(dbus, matrix, info, room)
7
36
  @dbus = dbus
8
37
  @info = info
@@ -16,8 +45,19 @@ module MatrixQQ
16
45
  type = msg['msgtype']
17
46
  sender = user @info['sender']
18
47
  sender, body = user_bot body if user_bot? body
19
- MatrixQQ::QQ::SendGroup.text \
20
- @matrix, @room, format_matrix_message(body, sender, type)
48
+ message = format_matrix_message(body, sender, type)
49
+ MatrixQQ::QQ::SendGroup.array @matrix, @room, emoji(message)
50
+ end
51
+
52
+ def emoji(msg)
53
+ msg.each_codepoint.inject([]) do |obj, code|
54
+ obj <<
55
+ if Emoji.include? code
56
+ { type: 'emoji', data: { id: code.to_s } }
57
+ else
58
+ { type: 'text', data: { text: [code].pack('U') } }
59
+ end
60
+ end
21
61
  end
22
62
 
23
63
  def format_matrix_message(msg, name, type = 'm.text')
@@ -5,9 +5,17 @@ module MatrixQQ
5
5
  dbus.send_group_msg group_id: room_id, message: body
6
6
  end
7
7
 
8
+ def self.array(dbus, room_id, message)
9
+ return if message.nil?
10
+ return unless message.is_a? Array
11
+ return if message.empty?
12
+ raw dbus, room_id, message
13
+ end
14
+
8
15
  def self.text(dbus, room_id, message)
9
16
  return if message.nil?
10
- raw dbus, room_id, [message]
17
+ return unless message.is_a? String
18
+ raw dbus, room_id, message
11
19
  end
12
20
  end # Send
13
21
  end # Matrix
@@ -1,3 +1,3 @@
1
1
  module MatrixQQ
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matrix_qq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 71e6fd52