mij-discord 1.0.5 → 1.0.6
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/mij-discord/bot.rb +25 -22
- data/lib/mij-discord/cache.rb +6 -6
- data/lib/mij-discord/core/api.rb +19 -28
- data/lib/mij-discord/core/api/channel.rb +60 -60
- data/lib/mij-discord/core/api/invite.rb +6 -6
- data/lib/mij-discord/core/api/server.rb +81 -68
- data/lib/mij-discord/core/api/user.rb +21 -22
- data/lib/mij-discord/core/gateway.rb +5 -5
- data/lib/mij-discord/data/application.rb +0 -4
- data/lib/mij-discord/data/channel.rb +17 -21
- data/lib/mij-discord/data/emoji.rb +0 -4
- data/lib/mij-discord/data/invite.rb +1 -5
- data/lib/mij-discord/data/member.rb +5 -13
- data/lib/mij-discord/data/message.rb +9 -13
- data/lib/mij-discord/data/role.rb +2 -8
- data/lib/mij-discord/data/server.rb +67 -16
- data/lib/mij-discord/data/user.rb +2 -6
- data/lib/mij-discord/version.rb +1 -1
- metadata +2 -2
@@ -4,39 +4,39 @@ module MijDiscord::Core::API::Invite
|
|
4
4
|
class << self
|
5
5
|
# Resolve an invite
|
6
6
|
# https://discordapp.com/developers/docs/resources/invite#get-invite
|
7
|
-
def resolve(
|
7
|
+
def resolve(auth, invite_code)
|
8
8
|
MijDiscord::Core::API.request(
|
9
9
|
:invite_code,
|
10
10
|
nil,
|
11
11
|
:get,
|
12
12
|
"#{MijDiscord::Core::API::APIBASE_URL}/invites/#{invite_code}",
|
13
|
-
Authorization:
|
13
|
+
Authorization: auth
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Delete an invite by code
|
18
18
|
# https://discordapp.com/developers/docs/resources/invite#delete-invite
|
19
|
-
def delete(
|
19
|
+
def delete(auth, code, reason = nil)
|
20
20
|
MijDiscord::Core::API.request(
|
21
21
|
:invites_code,
|
22
22
|
nil,
|
23
23
|
:delete,
|
24
24
|
"#{MijDiscord::Core::API::APIBASE_URL}/invites/#{code}",
|
25
|
-
Authorization:
|
25
|
+
Authorization: auth,
|
26
26
|
'X-Audit-Log-Reason': reason
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
30
|
# Join a server using an invite
|
31
31
|
# https://discordapp.com/developers/docs/resources/invite#accept-invite
|
32
|
-
def accept(
|
32
|
+
def accept(auth, invite_code)
|
33
33
|
MijDiscord::Core::API.request(
|
34
34
|
:invite_code,
|
35
35
|
nil,
|
36
36
|
:post,
|
37
37
|
"#{MijDiscord::Core::API::APIBASE_URL}/invites/#{invite_code}",
|
38
38
|
nil,
|
39
|
-
Authorization:
|
39
|
+
Authorization: auth
|
40
40
|
)
|
41
41
|
end
|
42
42
|
end
|
@@ -4,33 +4,33 @@ module MijDiscord::Core::API::Server
|
|
4
4
|
class << self
|
5
5
|
# Create a server
|
6
6
|
# https://discordapp.com/developers/docs/resources/guild#create-guild
|
7
|
-
def create(
|
7
|
+
def create(auth, name, region = :'eu-central')
|
8
8
|
MijDiscord::Core::API.request(
|
9
9
|
:guilds,
|
10
10
|
nil,
|
11
11
|
:post,
|
12
12
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds",
|
13
13
|
{ name: name, region: region.to_s }.to_json,
|
14
|
-
Authorization:
|
14
|
+
Authorization: auth,
|
15
15
|
content_type: :json
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Get a server's data
|
20
20
|
# https://discordapp.com/developers/docs/resources/guild#get-guild
|
21
|
-
def resolve(
|
21
|
+
def resolve(auth, server_id)
|
22
22
|
MijDiscord::Core::API.request(
|
23
23
|
:guilds_sid,
|
24
24
|
server_id,
|
25
25
|
:get,
|
26
26
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}",
|
27
|
-
Authorization:
|
27
|
+
Authorization: auth
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Update a server
|
32
32
|
# https://discordapp.com/developers/docs/resources/guild#modify-guild
|
33
|
-
def update(
|
33
|
+
def update(auth, server_id, name, region, icon, afk_channel_id, afk_timeout, reason = nil)
|
34
34
|
MijDiscord::Core::API.request(
|
35
35
|
:guilds_sid,
|
36
36
|
server_id,
|
@@ -40,21 +40,21 @@ module MijDiscord::Core::API::Server
|
|
40
40
|
name: name, region: region, icon: icon,
|
41
41
|
afk_channel_id: afk_channel_id, afk_timeout: afk_timeout
|
42
42
|
}.delete_if {|_, v| v.nil? }.to_json,
|
43
|
-
Authorization:
|
43
|
+
Authorization: auth,
|
44
44
|
content_type: :json,
|
45
45
|
'X-Audit-Log-Reason': reason
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
49
49
|
# Transfer server ownership
|
50
|
-
def transfer_ownership(
|
50
|
+
def transfer_ownership(auth, server_id, user_id, reason = nil)
|
51
51
|
MijDiscord::Core::API.request(
|
52
52
|
:guilds_sid,
|
53
53
|
server_id,
|
54
54
|
:patch,
|
55
55
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}",
|
56
56
|
{ owner_id: user_id }.to_json,
|
57
|
-
Authorization:
|
57
|
+
Authorization: auth,
|
58
58
|
content_type: :json,
|
59
59
|
'X-Audit-Log-Reason': reason
|
60
60
|
)
|
@@ -62,38 +62,38 @@ module MijDiscord::Core::API::Server
|
|
62
62
|
|
63
63
|
# Delete a server
|
64
64
|
# https://discordapp.com/developers/docs/resources/guild#delete-guild
|
65
|
-
def delete(
|
65
|
+
def delete(auth, server_id)
|
66
66
|
MijDiscord::Core::API.request(
|
67
67
|
:guilds_sid,
|
68
68
|
server_id,
|
69
69
|
:delete,
|
70
70
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}",
|
71
|
-
Authorization:
|
71
|
+
Authorization: auth
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
75
|
# Get a server's channels list
|
76
76
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-channels
|
77
|
-
def channels(
|
77
|
+
def channels(auth, server_id)
|
78
78
|
MijDiscord::Core::API.request(
|
79
79
|
:guilds_sid_channels,
|
80
80
|
server_id,
|
81
81
|
:get,
|
82
82
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/channels",
|
83
|
-
Authorization:
|
83
|
+
Authorization: auth
|
84
84
|
)
|
85
85
|
end
|
86
86
|
|
87
87
|
# Create a channel
|
88
88
|
# https://discordapp.com/developers/docs/resources/guild#create-guild-channel
|
89
|
-
def create_channel(
|
89
|
+
def create_channel(auth, server_id, name, type, bitrate, user_limit, permissions, nsfw, reason = nil)
|
90
90
|
MijDiscord::Core::API.request(
|
91
91
|
:guilds_sid_channels,
|
92
92
|
server_id,
|
93
93
|
:post,
|
94
94
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/channels",
|
95
95
|
{ name: name, type: type, bitrate: bitrate, user_limit: user_limit, permission_overwrites: permissions, nsfw: nsfw }.to_json,
|
96
|
-
Authorization:
|
96
|
+
Authorization: auth,
|
97
97
|
content_type: :json,
|
98
98
|
'X-Audit-Log-Reason': reason
|
99
99
|
)
|
@@ -101,14 +101,14 @@ module MijDiscord::Core::API::Server
|
|
101
101
|
|
102
102
|
# Update a channels position
|
103
103
|
# https://discordapp.com/developers/docs/resources/guild#modify-guild-channel
|
104
|
-
def update_channel_position(
|
104
|
+
def update_channel_position(auth, server_id, channel_id, position, reason = nil)
|
105
105
|
MijDiscord::Core::API.request(
|
106
106
|
:guilds_sid_channels,
|
107
107
|
server_id,
|
108
108
|
:patch,
|
109
109
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/channels",
|
110
110
|
{ id: channel_id, position: position }.to_json,
|
111
|
-
Authorization:
|
111
|
+
Authorization: auth,
|
112
112
|
content_type: :json,
|
113
113
|
'X-Audit-Log-Reason': reason
|
114
114
|
)
|
@@ -116,38 +116,38 @@ module MijDiscord::Core::API::Server
|
|
116
116
|
|
117
117
|
# Get a member's data
|
118
118
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-member
|
119
|
-
def resolve_member(
|
119
|
+
def resolve_member(auth, server_id, user_id)
|
120
120
|
MijDiscord::Core::API.request(
|
121
121
|
:guilds_sid_members_uid,
|
122
122
|
server_id,
|
123
123
|
:get,
|
124
124
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}",
|
125
|
-
Authorization:
|
125
|
+
Authorization: auth
|
126
126
|
)
|
127
127
|
end
|
128
128
|
|
129
129
|
# Gets members from the server
|
130
130
|
# https://discordapp.com/developers/docs/resources/guild#list-guild-members
|
131
|
-
def resolve_members(
|
131
|
+
def resolve_members(auth, server_id, limit, after = nil)
|
132
132
|
MijDiscord::Core::API.request(
|
133
133
|
:guilds_sid_members,
|
134
134
|
server_id,
|
135
135
|
:get,
|
136
136
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members?limit=#{limit}#{"&after=#{after}" if after}",
|
137
|
-
Authorization:
|
137
|
+
Authorization: auth
|
138
138
|
)
|
139
139
|
end
|
140
140
|
|
141
141
|
# Update a user properties
|
142
142
|
# https://discordapp.com/developers/docs/resources/guild#modify-guild-member
|
143
|
-
def update_member(
|
143
|
+
def update_member(auth, server_id, user_id, reason = nil, nick: nil, roles: nil, mute: nil, deaf: nil, channel_id: nil)
|
144
144
|
MijDiscord::Core::API.request(
|
145
145
|
:guilds_sid_members_uid,
|
146
146
|
server_id,
|
147
147
|
:patch,
|
148
148
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}",
|
149
149
|
{ roles: roles, nick: nick, mute: mute, deaf: deaf, channel_id: channel_id }.delete_if {|_,v| v.nil? }.to_json,
|
150
|
-
Authorization:
|
150
|
+
Authorization: auth,
|
151
151
|
content_type: :json,
|
152
152
|
'X-Audit-Log-Reason': reason
|
153
153
|
)
|
@@ -155,13 +155,13 @@ module MijDiscord::Core::API::Server
|
|
155
155
|
|
156
156
|
# Remove user from server
|
157
157
|
# https://discordapp.com/developers/docs/resources/guild#remove-guild-member
|
158
|
-
def remove_member(
|
158
|
+
def remove_member(auth, server_id, user_id, reason = nil)
|
159
159
|
MijDiscord::Core::API.request(
|
160
160
|
:guilds_sid_members_uid,
|
161
161
|
server_id,
|
162
162
|
:delete,
|
163
163
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}",
|
164
|
-
Authorization:
|
164
|
+
Authorization: auth,
|
165
165
|
content_type: :json,
|
166
166
|
'X-Audit-Log-Reason': reason
|
167
167
|
)
|
@@ -169,52 +169,52 @@ module MijDiscord::Core::API::Server
|
|
169
169
|
|
170
170
|
# Get a server's banned users
|
171
171
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-bans
|
172
|
-
def bans(
|
172
|
+
def bans(auth, server_id)
|
173
173
|
MijDiscord::Core::API.request(
|
174
174
|
:guilds_sid_bans,
|
175
175
|
server_id,
|
176
176
|
:get,
|
177
177
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans",
|
178
|
-
Authorization:
|
178
|
+
Authorization: auth
|
179
179
|
)
|
180
180
|
end
|
181
181
|
|
182
182
|
# Ban a user from a server and delete their messages from the last message_days days
|
183
183
|
# https://discordapp.com/developers/docs/resources/guild#create-guild-ban
|
184
|
-
def ban_user(
|
184
|
+
def ban_user(auth, server_id, user_id, message_days, reason = nil)
|
185
185
|
MijDiscord::Core::API.request(
|
186
186
|
:guilds_sid_bans_uid,
|
187
187
|
server_id,
|
188
188
|
:put,
|
189
189
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans/#{user_id}?delete-message-days=#{message_days}",
|
190
190
|
nil,
|
191
|
-
Authorization:
|
191
|
+
Authorization: auth,
|
192
192
|
'X-Audit-Log-Reason': reason
|
193
193
|
)
|
194
194
|
end
|
195
195
|
|
196
196
|
# Unban a user from a server
|
197
197
|
# https://discordapp.com/developers/docs/resources/guild#remove-guild-ban
|
198
|
-
def unban_user(
|
198
|
+
def unban_user(auth, server_id, user_id, reason = nil)
|
199
199
|
MijDiscord::Core::API.request(
|
200
200
|
:guilds_sid_bans_uid,
|
201
201
|
server_id,
|
202
202
|
:delete,
|
203
203
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans/#{user_id}",
|
204
|
-
Authorization:
|
204
|
+
Authorization: auth,
|
205
205
|
'X-Audit-Log-Reason': reason
|
206
206
|
)
|
207
207
|
end
|
208
208
|
|
209
209
|
# Get server roles
|
210
210
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-roles
|
211
|
-
def roles(
|
211
|
+
def roles(auth, server_id)
|
212
212
|
MijDiscord::Core::API.request(
|
213
213
|
:guilds_sid_roles,
|
214
214
|
server_id,
|
215
215
|
:get,
|
216
216
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles",
|
217
|
-
Authorization:
|
217
|
+
Authorization: auth
|
218
218
|
)
|
219
219
|
end
|
220
220
|
|
@@ -223,14 +223,14 @@ module MijDiscord::Core::API::Server
|
|
223
223
|
# sending TTS messages, embedding links, sending files, reading the history, mentioning everybody,
|
224
224
|
# connecting to voice, speaking and voice activity (push-to-talk isn't mandatory)
|
225
225
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-roles
|
226
|
-
def create_role(
|
226
|
+
def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)
|
227
227
|
MijDiscord::Core::API.request(
|
228
228
|
:guilds_sid_roles,
|
229
229
|
server_id,
|
230
230
|
:post,
|
231
231
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles",
|
232
232
|
{ color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,
|
233
|
-
Authorization:
|
233
|
+
Authorization: auth,
|
234
234
|
content_type: :json,
|
235
235
|
'X-Audit-Log-Reason': reason
|
236
236
|
)
|
@@ -241,7 +241,7 @@ module MijDiscord::Core::API::Server
|
|
241
241
|
# sending TTS messages, embedding links, sending files, reading the history, mentioning everybody,
|
242
242
|
# connecting to voice, speaking and voice activity (push-to-talk isn't mandatory)
|
243
243
|
# https://discordapp.com/developers/docs/resources/guild#modify-guild-role
|
244
|
-
def update_role(
|
244
|
+
def update_role(auth, server_id, role_id, name, color, hoist, mentionable, permissions, reason = nil)
|
245
245
|
MijDiscord::Core::API.request(
|
246
246
|
:guilds_sid_roles_rid,
|
247
247
|
server_id,
|
@@ -251,7 +251,7 @@ module MijDiscord::Core::API::Server
|
|
251
251
|
color: color, name: name, hoist: hoist,
|
252
252
|
mentionable: mentionable, permissions: permissions
|
253
253
|
}.delete_if {|_, v| v.nil? }.to_json,
|
254
|
-
Authorization:
|
254
|
+
Authorization: auth,
|
255
255
|
content_type: :json,
|
256
256
|
'X-Audit-Log-Reason': reason
|
257
257
|
)
|
@@ -259,206 +259,219 @@ module MijDiscord::Core::API::Server
|
|
259
259
|
|
260
260
|
# Delete a role
|
261
261
|
# https://discordapp.com/developers/docs/resources/guild#delete-guild-role
|
262
|
-
def delete_role(
|
262
|
+
def delete_role(auth, server_id, role_id, reason = nil)
|
263
263
|
MijDiscord::Core::API.request(
|
264
264
|
:guilds_sid_roles_rid,
|
265
265
|
server_id,
|
266
266
|
:delete,
|
267
267
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles/#{role_id}",
|
268
|
-
Authorization:
|
268
|
+
Authorization: auth,
|
269
269
|
'X-Audit-Log-Reason': reason
|
270
270
|
)
|
271
271
|
end
|
272
272
|
|
273
273
|
# Adds a single role to a member
|
274
274
|
# https://discordapp.com/developers/docs/resources/guild#add-guild-member-role
|
275
|
-
def add_member_role(
|
275
|
+
def add_member_role(auth, server_id, user_id, role_id, reason = nil)
|
276
276
|
MijDiscord::Core::API.request(
|
277
277
|
:guilds_sid_members_uid_roles_rid,
|
278
278
|
server_id,
|
279
279
|
:put,
|
280
280
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}/roles/#{role_id}",
|
281
281
|
nil,
|
282
|
-
Authorization:
|
282
|
+
Authorization: auth,
|
283
283
|
'X-Audit-Log-Reason': reason
|
284
284
|
)
|
285
285
|
end
|
286
286
|
|
287
287
|
# Removes a single role from a member
|
288
288
|
# https://discordapp.com/developers/docs/resources/guild#remove-guild-member-role
|
289
|
-
def remove_member_role(
|
289
|
+
def remove_member_role(auth, server_id, user_id, role_id, reason = nil)
|
290
290
|
MijDiscord::Core::API.request(
|
291
291
|
:guilds_sid_members_uid_roles_rid,
|
292
292
|
server_id,
|
293
293
|
:delete,
|
294
294
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}/roles/#{role_id}",
|
295
|
-
Authorization:
|
295
|
+
Authorization: auth,
|
296
296
|
'X-Audit-Log-Reason': reason
|
297
297
|
)
|
298
298
|
end
|
299
299
|
|
300
300
|
# Get server prune count
|
301
301
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-prune-count
|
302
|
-
def prune_count(
|
302
|
+
def prune_count(auth, server_id, days)
|
303
303
|
MijDiscord::Core::API.request(
|
304
304
|
:guilds_sid_prune,
|
305
305
|
server_id,
|
306
306
|
:get,
|
307
307
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/prune?days=#{days}",
|
308
|
-
Authorization:
|
308
|
+
Authorization: auth
|
309
309
|
)
|
310
310
|
end
|
311
311
|
|
312
312
|
# Begin server prune
|
313
313
|
# https://discordapp.com/developers/docs/resources/guild#begin-guild-prune
|
314
|
-
def begin_prune(
|
314
|
+
def begin_prune(auth, server_id, days, reason = nil)
|
315
315
|
MijDiscord::Core::API.request(
|
316
316
|
:guilds_sid_prune,
|
317
317
|
server_id,
|
318
318
|
:post,
|
319
319
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/prune",
|
320
320
|
{ days: days }.to_json,
|
321
|
-
Authorization:
|
321
|
+
Authorization: auth,
|
322
322
|
'X-Audit-Log-Reason': reason
|
323
323
|
)
|
324
324
|
end
|
325
325
|
|
326
326
|
# Get invites from server
|
327
327
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-invites
|
328
|
-
def invites(
|
328
|
+
def invites(auth, server_id)
|
329
329
|
MijDiscord::Core::API.request(
|
330
330
|
:guilds_sid_invites,
|
331
331
|
server_id,
|
332
332
|
:get,
|
333
333
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites",
|
334
|
-
Authorization:
|
334
|
+
Authorization: auth
|
335
335
|
)
|
336
336
|
end
|
337
337
|
|
338
338
|
# Get server integrations
|
339
339
|
# https://discordapp.com/developers/docs/resources/guild#get-guild-integrations
|
340
|
-
def integrations(
|
340
|
+
def integrations(auth, server_id)
|
341
341
|
MijDiscord::Core::API.request(
|
342
342
|
:guilds_sid_integrations,
|
343
343
|
server_id,
|
344
344
|
:get,
|
345
345
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations",
|
346
|
-
Authorization:
|
346
|
+
Authorization: auth
|
347
347
|
)
|
348
348
|
end
|
349
349
|
|
350
350
|
# Create a server integration
|
351
351
|
# https://discordapp.com/developers/docs/resources/guild#create-guild-integration
|
352
|
-
def create_integration(
|
352
|
+
def create_integration(auth, server_id, type, id)
|
353
353
|
MijDiscord::Core::API.request(
|
354
354
|
:guilds_sid_integrations,
|
355
355
|
server_id,
|
356
356
|
:post,
|
357
357
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations",
|
358
358
|
{ type: type, id: id }.to_json,
|
359
|
-
Authorization:
|
359
|
+
Authorization: auth
|
360
360
|
)
|
361
361
|
end
|
362
362
|
|
363
363
|
# Update integration from server
|
364
364
|
# https://discordapp.com/developers/docs/resources/guild#modify-guild-integration
|
365
|
-
def update_integration(
|
365
|
+
def update_integration(auth, server_id, integration_id, expire_behavior, expire_grace_period, enable_emoticons)
|
366
366
|
MijDiscord::Core::API.request(
|
367
367
|
:guilds_sid_integrations_iid,
|
368
368
|
server_id,
|
369
369
|
:patch,
|
370
370
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}",
|
371
371
|
{ expire_behavior: expire_behavior, expire_grace_period: expire_grace_period, enable_emoticons: enable_emoticons }.to_json,
|
372
|
-
Authorization:
|
372
|
+
Authorization: auth,
|
373
373
|
content_type: :json
|
374
374
|
)
|
375
375
|
end
|
376
376
|
|
377
377
|
# Delete a server integration
|
378
378
|
# https://discordapp.com/developers/docs/resources/guild#delete-guild-integration
|
379
|
-
def delete_integration(
|
379
|
+
def delete_integration(auth, server_id, integration_id)
|
380
380
|
MijDiscord::Core::API.request(
|
381
381
|
:guilds_sid_integrations_iid,
|
382
382
|
server_id,
|
383
383
|
:delete,
|
384
384
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}",
|
385
|
-
Authorization:
|
385
|
+
Authorization: auth
|
386
386
|
)
|
387
387
|
end
|
388
388
|
|
389
389
|
# Sync an integration
|
390
390
|
# https://discordapp.com/developers/docs/resources/guild#sync-guild-integration
|
391
|
-
def sync_integration(
|
391
|
+
def sync_integration(auth, server_id, integration_id)
|
392
392
|
MijDiscord::Core::API.request(
|
393
393
|
:guilds_sid_integrations_iid_sync,
|
394
394
|
server_id,
|
395
395
|
:post,
|
396
396
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}/sync",
|
397
397
|
nil,
|
398
|
-
Authorization:
|
398
|
+
Authorization: auth
|
399
399
|
)
|
400
400
|
end
|
401
401
|
|
402
402
|
# Adds a custom emoji
|
403
|
-
def add_emoji(
|
403
|
+
def add_emoji(auth, server_id, image, name, reason = nil)
|
404
404
|
MijDiscord::Core::API.request(
|
405
405
|
:guilds_sid_emojis,
|
406
406
|
server_id,
|
407
407
|
:post,
|
408
408
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/emojis",
|
409
409
|
{ image: image, name: name }.to_json,
|
410
|
-
Authorization:
|
410
|
+
Authorization: auth,
|
411
411
|
content_type: :json,
|
412
412
|
'X-Audit-Log-Reason': reason
|
413
413
|
)
|
414
414
|
end
|
415
415
|
|
416
416
|
# Changes an emoji name
|
417
|
-
def edit_emoji(
|
417
|
+
def edit_emoji(auth, server_id, emoji_id, name, reason = nil)
|
418
418
|
MijDiscord::Core::API.request(
|
419
419
|
:guilds_sid_emojis_eid,
|
420
420
|
server_id,
|
421
421
|
:patch,
|
422
422
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/emojis/#{emoji_id}",
|
423
423
|
{ name: name }.to_json,
|
424
|
-
Authorization:
|
424
|
+
Authorization: auth,
|
425
425
|
content_type: :json,
|
426
426
|
'X-Audit-Log-Reason': reason
|
427
427
|
)
|
428
428
|
end
|
429
429
|
|
430
430
|
# Deletes a custom emoji
|
431
|
-
def delete_emoji(
|
431
|
+
def delete_emoji(auth, server_id, emoji_id, reason = nil)
|
432
432
|
MijDiscord::Core::API.request(
|
433
433
|
:guilds_sid_emojis_eid,
|
434
434
|
server_id,
|
435
435
|
:delete,
|
436
436
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/emojis/#{emoji_id}",
|
437
|
-
Authorization:
|
437
|
+
Authorization: auth,
|
438
438
|
'X-Audit-Log-Reason': reason
|
439
439
|
)
|
440
440
|
end
|
441
441
|
|
442
442
|
# Available voice regions for this server
|
443
|
-
def regions(
|
443
|
+
def regions(auth, server_id)
|
444
444
|
MijDiscord::Core::API.request(
|
445
445
|
:guilds_sid_regions,
|
446
446
|
server_id,
|
447
447
|
:get,
|
448
448
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/regions",
|
449
|
-
Authorization:
|
449
|
+
Authorization: auth
|
450
450
|
)
|
451
451
|
end
|
452
452
|
|
453
453
|
# Get server webhooks
|
454
454
|
# https://discordapp.com/developers/docs/resources/webhook#get-guild-webhooks
|
455
|
-
def webhooks(
|
455
|
+
def webhooks(auth, server_id)
|
456
456
|
MijDiscord::Core::API.request(
|
457
457
|
:guilds_sid_webhooks,
|
458
458
|
server_id,
|
459
459
|
:get,
|
460
460
|
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/webhooks",
|
461
|
-
Authorization:
|
461
|
+
Authorization: auth
|
462
|
+
)
|
463
|
+
end
|
464
|
+
|
465
|
+
# Search messages (for userbots only)
|
466
|
+
# Not officially documented, reverse engineered from tracking Discord's network activity
|
467
|
+
def search_messages(auth, server_id, options)
|
468
|
+
options = URI.encode_www_form(options)
|
469
|
+
MijDiscord::Core::API.request(
|
470
|
+
:guilds_guild_messages_search,
|
471
|
+
server_id,
|
472
|
+
:get,
|
473
|
+
"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/messages/search?#{options}",
|
474
|
+
Authorization: auth
|
462
475
|
)
|
463
476
|
end
|
464
477
|
end
|