chat_sdk-x 1.1.0 → 1.2.0

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: 60d7ec7a7720f58f4d1059b32a93fe805a01e2b8eef5b65ded9f211f85c7cb54
4
- data.tar.gz: 331da1b589a8eb037f5c74a78a41b32fe531602b377e70b340b1f8741a1df6d5
3
+ metadata.gz: d0fdc8ea1ae7ebd3bee9269c50d80aabfdc171c0db0bdb656a4f8d3c2a72a335
4
+ data.tar.gz: a3d94f952c9867e4ca6dba3b9fe0c89a46454c2a09901f9bbccc6267d612ab2c
5
5
  SHA512:
6
- metadata.gz: 564cc3d6c920c95cbd07814dbf45334ac3825c65185ede6fdc30ec40a69b295ada2b94c83ba4dec841b113b765f60d80aed056dda5b24d16330e4fa5fd5ebe05
7
- data.tar.gz: b35c9f9f56f881c2f7f298746dca29a0cf50fba7f262516c80f37c2505a135510d9e88b6d32ea06fa794436ae8ce82b7c11ddcf46350cc0a1c43751a10a0856f
6
+ metadata.gz: 96b23bdea51ea3b313e1e9582e2e987803f495f253f8d8679f908c941ff9894284c20227850cefa5d96b30bf10d821b9b64a70a3c47c18cf3dde3e7c11753506
7
+ data.tar.gz: a76e43808b9ac0f780b317bf6f75968873ed55c8b3faf7a4aab2a1f6b7f74a404683c7c2e2e76a34325f510e93d43624f8708d873a3aa429239facdf349f07ce
@@ -124,7 +124,7 @@ module ChatSDK
124
124
  parse_tweet_message(result, channel_id)
125
125
  end
126
126
 
127
- def delete_message(channel_id:, message_id:) # rubocop:disable Lint/UnusedMethodArgument
127
+ def delete_message(channel_id:, message_id:, **_options) # rubocop:disable Lint/UnusedMethodArgument
128
128
  @client.delete_tweet(tweet_id: message_id)
129
129
  end
130
130
 
@@ -157,11 +157,11 @@ module ChatSDK
157
157
  end
158
158
  end
159
159
 
160
- def add_reaction(channel_id:, message_id:, emoji:) # rubocop:disable Lint/UnusedMethodArgument
160
+ def add_reaction(channel_id:, message_id:, emoji:, **_options) # rubocop:disable Lint/UnusedMethodArgument
161
161
  @client.like_tweet(user_id: @user_id, tweet_id: message_id)
162
162
  end
163
163
 
164
- def remove_reaction(channel_id:, message_id:, emoji:) # rubocop:disable Lint/UnusedMethodArgument
164
+ def remove_reaction(channel_id:, message_id:, emoji:, **_options) # rubocop:disable Lint/UnusedMethodArgument
165
165
  @client.unlike_tweet(user_id: @user_id, tweet_id: message_id)
166
166
  end
167
167
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "base64"
4
+ require "faraday/multipart"
4
5
 
5
6
  module ChatSDK
6
7
  module X
@@ -28,6 +28,12 @@ module ChatSDK
28
28
  message_id = data["id"] || data["id_str"]
29
29
  text = data["text"] || ""
30
30
  conversation_id = data["conversation_id"] || message_id
31
+ mention_entities = data.dig("entities", "mentions")
32
+ is_mention = if mention_entities.is_a?(Array)
33
+ !!(bot_user_id && mention_entities.any? do |mention|
34
+ (mention["id"] || mention["id_str"]).to_s == bot_user_id.to_s
35
+ end)
36
+ end
31
37
 
32
38
  msg = ChatSDK::Message.new(
33
39
  id: message_id&.to_s,
@@ -36,6 +42,7 @@ module ChatSDK
36
42
  thread_id: "x:post:#{conversation_id}",
37
43
  channel_id: author_id,
38
44
  platform: :x,
45
+ is_mention: is_mention,
39
46
  raw: data
40
47
  )
41
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chat_sdk-x
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Quentin Rousseau
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0.1'
18
+ version: '1.2'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '0.1'
25
+ version: '1.2'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: faraday
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: faraday-multipart
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
40
54
  description: X (Twitter) bot adapter for the ChatSDK framework
41
55
  email:
42
56
  - quentin@rootly.com