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