chat_sdk-discord 0.5.0 → 0.6.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 +13 -0
- data/lib/chat_sdk/discord/api_client.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48fe551dfea184269a21798805245389d7ddced76cff1f575000583d884541a6
|
|
4
|
+
data.tar.gz: 5a26bbdba497b93dbb2a99f0fff5cd7a98eb5d0b37ca729e7179792d5f2ae099
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ccb7efe2bd35ab8f88f6d3b7644c1b386b20955053062056978d617e6bfd5240e4890bc4a791e60826a0cadfb4c4fd9ba4d5d0462df634fae5d19c9165bc2a69
|
|
7
|
+
data.tar.gz: d6346f57703d07dbf352abd490ea682f01dc175a4410de307242f28d406c65f655838c75b9d872c3a37a08d3371c83077f08254725ee0a004f5804d94e47a2d8
|
|
@@ -117,6 +117,19 @@ module ChatSDK
|
|
|
117
117
|
@client.remove_reaction(channel_id, message_id, emoji)
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
def get_user(user_id)
|
|
121
|
+
data = @client.get_user(user_id)
|
|
122
|
+
return nil unless data && data["id"]
|
|
123
|
+
|
|
124
|
+
ChatSDK::Author.new(
|
|
125
|
+
id: data["id"],
|
|
126
|
+
name: data["username"],
|
|
127
|
+
platform: :discord,
|
|
128
|
+
bot: data["bot"] || false,
|
|
129
|
+
raw: data
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
120
133
|
def open_dm(user_id)
|
|
121
134
|
@dm_channels[user_id] ||= @client.create_dm(user_id)["id"]
|
|
122
135
|
end
|
|
@@ -44,6 +44,11 @@ module ChatSDK
|
|
|
44
44
|
request(:delete, "#{API_PREFIX}/channels/#{channel_id}/messages/#{message_id}/reactions/#{encoded}/@me")
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# Users
|
|
48
|
+
def get_user(user_id)
|
|
49
|
+
request(:get, "#{API_PREFIX}/users/#{user_id}")
|
|
50
|
+
end
|
|
51
|
+
|
|
47
52
|
# DMs
|
|
48
53
|
def create_dm(user_id)
|
|
49
54
|
request(:post, "#{API_PREFIX}/users/@me/channels", {"recipient_id" => user_id})
|