chat_sdk-discord 1.1.0 → 1.3.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 +4 -4
- data/lib/chat_sdk/discord/adapter.rb +8 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6d876642eab93edea52465cad25e4c5fbd37ad4d8d3cbbef1fb85b4506d285c
|
|
4
|
+
data.tar.gz: 710c6d59e2285c7ea7fb86972836b6ac8d887a45a9d3fd2edee39c6c95c82347
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4299cbce4ecb1030ee1114187a68f8b83bca76e3336890e1d9854473d6f8acffe736b67e1516bbbbd7faf97585d79b858148ba554070910b608527d3ce29713
|
|
7
|
+
data.tar.gz: 0d878692b857603ecc889076669d72db4de82023b33364c79d9c84592d94ad1fe929df381f66e04ea5c25adfc7cc02c3fff15e9923cf3f3c6a59f526ab43e5f8
|
|
@@ -9,10 +9,11 @@ module ChatSDK
|
|
|
9
9
|
|
|
10
10
|
attr_reader :client
|
|
11
11
|
|
|
12
|
-
def initialize(bot_token: nil, public_key: nil, application_id: nil)
|
|
12
|
+
def initialize(bot_token: nil, public_key: nil, application_id: nil, bot_user_id: nil)
|
|
13
13
|
@bot_token = bot_token || ENV["DISCORD_BOT_TOKEN"]
|
|
14
14
|
@public_key = public_key || ENV["DISCORD_PUBLIC_KEY"]
|
|
15
15
|
@application_id = application_id || ENV["DISCORD_APPLICATION_ID"]
|
|
16
|
+
@bot_user_id = bot_user_id || ENV["DISCORD_BOT_USER_ID"] || @application_id
|
|
16
17
|
|
|
17
18
|
raise ChatSDK::ConfigurationError, "Discord bot_token required" unless @bot_token
|
|
18
19
|
|
|
@@ -89,7 +90,7 @@ module ChatSDK
|
|
|
89
90
|
)
|
|
90
91
|
end
|
|
91
92
|
|
|
92
|
-
def edit_message(channel_id:, message_id:, message
|
|
93
|
+
def edit_message(channel_id:, message_id:, message:, **_options)
|
|
93
94
|
content, embeds, components = prepare_message_payload(message)
|
|
94
95
|
|
|
95
96
|
@client.edit_message(
|
|
@@ -101,7 +102,7 @@ module ChatSDK
|
|
|
101
102
|
)
|
|
102
103
|
end
|
|
103
104
|
|
|
104
|
-
def delete_message(channel_id:, message_id
|
|
105
|
+
def delete_message(channel_id:, message_id:, **_options)
|
|
105
106
|
@client.delete_message(channel_id, message_id)
|
|
106
107
|
end
|
|
107
108
|
|
|
@@ -109,11 +110,11 @@ module ChatSDK
|
|
|
109
110
|
@client.upload_file(channel_id, io, filename)
|
|
110
111
|
end
|
|
111
112
|
|
|
112
|
-
def add_reaction(channel_id:, message_id:, emoji
|
|
113
|
+
def add_reaction(channel_id:, message_id:, emoji:, **_options)
|
|
113
114
|
@client.add_reaction(channel_id, message_id, emoji)
|
|
114
115
|
end
|
|
115
116
|
|
|
116
|
-
def remove_reaction(channel_id:, message_id:, emoji
|
|
117
|
+
def remove_reaction(channel_id:, message_id:, emoji:, **_options)
|
|
117
118
|
@client.remove_reaction(channel_id, message_id, emoji)
|
|
118
119
|
end
|
|
119
120
|
|
|
@@ -146,7 +147,7 @@ module ChatSDK
|
|
|
146
147
|
[messages, next_cursor]
|
|
147
148
|
end
|
|
148
149
|
|
|
149
|
-
def start_typing(channel_id:, thread_id: nil)
|
|
150
|
+
def start_typing(channel_id:, thread_id: nil, message_id: nil)
|
|
150
151
|
@client.trigger_typing(channel_id)
|
|
151
152
|
end
|
|
152
153
|
|
|
@@ -249,6 +250,7 @@ module ChatSDK
|
|
|
249
250
|
thread_id: data["id"],
|
|
250
251
|
channel_id: channel_id,
|
|
251
252
|
platform: :discord,
|
|
253
|
+
is_mention: !!(@bot_user_id && Array(data["mentions"]).any? { |mention| mention["id"].to_s == @bot_user_id }),
|
|
252
254
|
raw: data
|
|
253
255
|
)
|
|
254
256
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chat_sdk-discord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.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: '
|
|
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: '
|
|
25
|
+
version: '1.2'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: faraday
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|