disgroove 1.3.3-dev.2 → 1.3.3-test.1

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.
Files changed (277) hide show
  1. package/dist/package.json +1 -1
  2. package/package.json +1 -1
  3. package/dist/lib/Client.d.ts +0 -234
  4. package/dist/lib/Client.js +0 -256
  5. package/dist/lib/Client.js.map +0 -1
  6. package/dist/lib/constants.d.ts +0 -1084
  7. package/dist/lib/constants.js +0 -1163
  8. package/dist/lib/constants.js.map +0 -1
  9. package/dist/lib/gateway/Shard.d.ts +0 -25
  10. package/dist/lib/gateway/Shard.js +0 -522
  11. package/dist/lib/gateway/Shard.js.map +0 -1
  12. package/dist/lib/gateway/ShardsManager.d.ts +0 -5
  13. package/dist/lib/gateway/ShardsManager.js +0 -13
  14. package/dist/lib/gateway/ShardsManager.js.map +0 -1
  15. package/dist/lib/gateway/index.d.ts +0 -2
  16. package/dist/lib/gateway/index.js +0 -19
  17. package/dist/lib/gateway/index.js.map +0 -1
  18. package/dist/lib/index.d.ts +0 -7
  19. package/dist/lib/index.js +0 -24
  20. package/dist/lib/index.js.map +0 -1
  21. package/dist/lib/rest/CDN.d.ts +0 -21
  22. package/dist/lib/rest/CDN.js +0 -46
  23. package/dist/lib/rest/CDN.js.map +0 -1
  24. package/dist/lib/rest/Endpoints.d.ts +0 -94
  25. package/dist/lib/rest/Endpoints.js +0 -211
  26. package/dist/lib/rest/Endpoints.js.map +0 -1
  27. package/dist/lib/rest/REST.d.ts +0 -22
  28. package/dist/lib/rest/REST.js +0 -35
  29. package/dist/lib/rest/REST.js.map +0 -1
  30. package/dist/lib/rest/RequestsManager.d.ts +0 -17
  31. package/dist/lib/rest/RequestsManager.js +0 -124
  32. package/dist/lib/rest/RequestsManager.js.map +0 -1
  33. package/dist/lib/rest/index.d.ts +0 -4
  34. package/dist/lib/rest/index.js +0 -34
  35. package/dist/lib/rest/index.js.map +0 -1
  36. package/dist/lib/structures/Application.d.ts +0 -174
  37. package/dist/lib/structures/Application.js +0 -328
  38. package/dist/lib/structures/Application.js.map +0 -1
  39. package/dist/lib/structures/ApplicationCommand.d.ts +0 -45
  40. package/dist/lib/structures/ApplicationCommand.js +0 -127
  41. package/dist/lib/structures/ApplicationCommand.js.map +0 -1
  42. package/dist/lib/structures/AuditLog.d.ts +0 -20
  43. package/dist/lib/structures/AuditLog.js +0 -76
  44. package/dist/lib/structures/AuditLog.js.map +0 -1
  45. package/dist/lib/structures/AutoModerationRule.d.ts +0 -34
  46. package/dist/lib/structures/AutoModerationRule.js +0 -96
  47. package/dist/lib/structures/AutoModerationRule.js.map +0 -1
  48. package/dist/lib/structures/Base.d.ts +0 -17
  49. package/dist/lib/structures/Base.js +0 -31
  50. package/dist/lib/structures/Base.js.map +0 -1
  51. package/dist/lib/structures/Channel.d.ts +0 -253
  52. package/dist/lib/structures/Channel.js +0 -591
  53. package/dist/lib/structures/Channel.js.map +0 -1
  54. package/dist/lib/structures/ClientApplication.d.ts +0 -150
  55. package/dist/lib/structures/ClientApplication.js +0 -241
  56. package/dist/lib/structures/ClientApplication.js.map +0 -1
  57. package/dist/lib/structures/Emoji.d.ts +0 -28
  58. package/dist/lib/structures/Emoji.js +0 -79
  59. package/dist/lib/structures/Emoji.js.map +0 -1
  60. package/dist/lib/structures/Entitlement.d.ts +0 -24
  61. package/dist/lib/structures/Entitlement.js +0 -68
  62. package/dist/lib/structures/Entitlement.js.map +0 -1
  63. package/dist/lib/structures/Guild.d.ts +0 -462
  64. package/dist/lib/structures/Guild.js +0 -1095
  65. package/dist/lib/structures/Guild.js.map +0 -1
  66. package/dist/lib/structures/GuildMember.d.ts +0 -50
  67. package/dist/lib/structures/GuildMember.js +0 -149
  68. package/dist/lib/structures/GuildMember.js.map +0 -1
  69. package/dist/lib/structures/GuildScheduledEvent.d.ts +0 -49
  70. package/dist/lib/structures/GuildScheduledEvent.js +0 -118
  71. package/dist/lib/structures/GuildScheduledEvent.js.map +0 -1
  72. package/dist/lib/structures/GuildTemplate.d.ts +0 -32
  73. package/dist/lib/structures/GuildTemplate.js +0 -76
  74. package/dist/lib/structures/GuildTemplate.js.map +0 -1
  75. package/dist/lib/structures/Integration.d.ts +0 -30
  76. package/dist/lib/structures/Integration.js +0 -102
  77. package/dist/lib/structures/Integration.js.map +0 -1
  78. package/dist/lib/structures/Interaction.d.ts +0 -76
  79. package/dist/lib/structures/Interaction.js +0 -345
  80. package/dist/lib/structures/Interaction.js.map +0 -1
  81. package/dist/lib/structures/Invite.d.ts +0 -28
  82. package/dist/lib/structures/Invite.js +0 -86
  83. package/dist/lib/structures/Invite.js.map +0 -1
  84. package/dist/lib/structures/Message.d.ts +0 -84
  85. package/dist/lib/structures/Message.js +0 -300
  86. package/dist/lib/structures/Message.js.map +0 -1
  87. package/dist/lib/structures/Role.d.ts +0 -37
  88. package/dist/lib/structures/Role.js +0 -90
  89. package/dist/lib/structures/Role.js.map +0 -1
  90. package/dist/lib/structures/SKU.d.ts +0 -23
  91. package/dist/lib/structures/SKU.js +0 -63
  92. package/dist/lib/structures/SKU.js.map +0 -1
  93. package/dist/lib/structures/StageInstance.d.ts +0 -24
  94. package/dist/lib/structures/StageInstance.js +0 -57
  95. package/dist/lib/structures/StageInstance.js.map +0 -1
  96. package/dist/lib/structures/Sticker.d.ts +0 -31
  97. package/dist/lib/structures/Sticker.js +0 -86
  98. package/dist/lib/structures/Sticker.js.map +0 -1
  99. package/dist/lib/structures/Team.d.ts +0 -14
  100. package/dist/lib/structures/Team.js +0 -39
  101. package/dist/lib/structures/Team.js.map +0 -1
  102. package/dist/lib/structures/TestEntitlement.d.ts +0 -23
  103. package/dist/lib/structures/TestEntitlement.js +0 -61
  104. package/dist/lib/structures/TestEntitlement.js.map +0 -1
  105. package/dist/lib/structures/UnavailableGuild.d.ts +0 -11
  106. package/dist/lib/structures/UnavailableGuild.js +0 -25
  107. package/dist/lib/structures/UnavailableGuild.js.map +0 -1
  108. package/dist/lib/structures/User.d.ts +0 -63
  109. package/dist/lib/structures/User.js +0 -177
  110. package/dist/lib/structures/User.js.map +0 -1
  111. package/dist/lib/structures/VoiceState.d.ts +0 -26
  112. package/dist/lib/structures/VoiceState.js +0 -70
  113. package/dist/lib/structures/VoiceState.js.map +0 -1
  114. package/dist/lib/structures/Webhook.d.ts +0 -84
  115. package/dist/lib/structures/Webhook.js +0 -239
  116. package/dist/lib/structures/Webhook.js.map +0 -1
  117. package/dist/lib/structures/index.d.ts +0 -27
  118. package/dist/lib/structures/index.js +0 -44
  119. package/dist/lib/structures/index.js.map +0 -1
  120. package/dist/lib/types/application-command.d.ts +0 -102
  121. package/dist/lib/types/application-command.js +0 -3
  122. package/dist/lib/types/application-command.js.map +0 -1
  123. package/dist/lib/types/application-role-connection-metadata.d.ts +0 -18
  124. package/dist/lib/types/application-role-connection-metadata.js +0 -3
  125. package/dist/lib/types/application-role-connection-metadata.js.map +0 -1
  126. package/dist/lib/types/application.d.ts +0 -66
  127. package/dist/lib/types/application.js +0 -3
  128. package/dist/lib/types/application.js.map +0 -1
  129. package/dist/lib/types/audit-log.d.ts +0 -82
  130. package/dist/lib/types/audit-log.js +0 -3
  131. package/dist/lib/types/audit-log.js.map +0 -1
  132. package/dist/lib/types/auto-moderation.d.ts +0 -65
  133. package/dist/lib/types/auto-moderation.js +0 -3
  134. package/dist/lib/types/auto-moderation.js.map +0 -1
  135. package/dist/lib/types/channel.d.ts +0 -456
  136. package/dist/lib/types/channel.js +0 -3
  137. package/dist/lib/types/channel.js.map +0 -1
  138. package/dist/lib/types/emoji.d.ts +0 -22
  139. package/dist/lib/types/emoji.js +0 -3
  140. package/dist/lib/types/emoji.js.map +0 -1
  141. package/dist/lib/types/entitlements.d.ts +0 -32
  142. package/dist/lib/types/entitlements.js +0 -3
  143. package/dist/lib/types/entitlements.js.map +0 -1
  144. package/dist/lib/types/gateway-events.d.ts +0 -805
  145. package/dist/lib/types/gateway-events.js +0 -3
  146. package/dist/lib/types/gateway-events.js.map +0 -1
  147. package/dist/lib/types/guild-scheduled-event.d.ts +0 -57
  148. package/dist/lib/types/guild-scheduled-event.js +0 -3
  149. package/dist/lib/types/guild-scheduled-event.js.map +0 -1
  150. package/dist/lib/types/guild-template.d.ts +0 -28
  151. package/dist/lib/types/guild-template.js +0 -3
  152. package/dist/lib/types/guild-template.js.map +0 -1
  153. package/dist/lib/types/guild.d.ts +0 -333
  154. package/dist/lib/types/guild.js +0 -3
  155. package/dist/lib/types/guild.js.map +0 -1
  156. package/dist/lib/types/index.d.ts +0 -23
  157. package/dist/lib/types/index.js +0 -40
  158. package/dist/lib/types/index.js.map +0 -1
  159. package/dist/lib/types/interaction.d.ts +0 -170
  160. package/dist/lib/types/interaction.js +0 -3
  161. package/dist/lib/types/interaction.js.map +0 -1
  162. package/dist/lib/types/invite.d.ts +0 -59
  163. package/dist/lib/types/invite.js +0 -3
  164. package/dist/lib/types/invite.js.map +0 -1
  165. package/dist/lib/types/message-components.d.ts +0 -100
  166. package/dist/lib/types/message-components.js +0 -3
  167. package/dist/lib/types/message-components.js.map +0 -1
  168. package/dist/lib/types/role.d.ts +0 -47
  169. package/dist/lib/types/role.js +0 -3
  170. package/dist/lib/types/role.js.map +0 -1
  171. package/dist/lib/types/sku.d.ts +0 -30
  172. package/dist/lib/types/sku.js +0 -3
  173. package/dist/lib/types/sku.js.map +0 -1
  174. package/dist/lib/types/stage-instance.d.ts +0 -20
  175. package/dist/lib/types/stage-instance.js +0 -3
  176. package/dist/lib/types/stage-instance.js.map +0 -1
  177. package/dist/lib/types/sticker.d.ts +0 -61
  178. package/dist/lib/types/sticker.js +0 -3
  179. package/dist/lib/types/sticker.js.map +0 -1
  180. package/dist/lib/types/team.d.ts +0 -30
  181. package/dist/lib/types/team.js +0 -3
  182. package/dist/lib/types/team.js.map +0 -1
  183. package/dist/lib/types/user.d.ts +0 -77
  184. package/dist/lib/types/user.js +0 -3
  185. package/dist/lib/types/user.js.map +0 -1
  186. package/dist/lib/types/voice.d.ts +0 -47
  187. package/dist/lib/types/voice.js +0 -3
  188. package/dist/lib/types/voice.js.map +0 -1
  189. package/dist/lib/types/webhook.d.ts +0 -31
  190. package/dist/lib/types/webhook.js +0 -3
  191. package/dist/lib/types/webhook.js.map +0 -1
  192. package/dist/lib/utils/Util.d.ts +0 -15
  193. package/dist/lib/utils/Util.js +0 -543
  194. package/dist/lib/utils/Util.js.map +0 -1
  195. package/dist/lib/utils/errors.d.ts +0 -12
  196. package/dist/lib/utils/errors.js +0 -25
  197. package/dist/lib/utils/errors.js.map +0 -1
  198. package/dist/lib/utils/index.d.ts +0 -2
  199. package/dist/lib/utils/index.js +0 -19
  200. package/dist/lib/utils/index.js.map +0 -1
  201. package/examples/applicationCommands.js +0 -43
  202. package/examples/buttons.js +0 -70
  203. package/examples/embeds.js +0 -36
  204. package/examples/ephemeralMessages.js +0 -32
  205. package/examples/files.js +0 -36
  206. package/examples/modalSubmit.js +0 -62
  207. package/examples/permissions.js +0 -41
  208. package/examples/selectMenus.js +0 -160
  209. package/examples/text.txt +0 -1
  210. package/lib/Client.ts +0 -616
  211. package/lib/constants.ts +0 -1173
  212. package/lib/gateway/Shard.ts +0 -704
  213. package/lib/gateway/ShardsManager.ts +0 -11
  214. package/lib/gateway/index.ts +0 -2
  215. package/lib/index.ts +0 -7
  216. package/lib/rest/CDN.ts +0 -56
  217. package/lib/rest/Endpoints.ts +0 -241
  218. package/lib/rest/REST.ts +0 -45
  219. package/lib/rest/RequestsManager.ts +0 -134
  220. package/lib/rest/index.ts +0 -4
  221. package/lib/structures/Application.ts +0 -599
  222. package/lib/structures/ApplicationCommand.ts +0 -187
  223. package/lib/structures/AuditLog.ts +0 -112
  224. package/lib/structures/AutoModerationRule.ts +0 -127
  225. package/lib/structures/Base.ts +0 -39
  226. package/lib/structures/Channel.ts +0 -921
  227. package/lib/structures/ClientApplication.ts +0 -515
  228. package/lib/structures/Emoji.ts +0 -95
  229. package/lib/structures/Entitlement.ts +0 -65
  230. package/lib/structures/Guild.ts +0 -1842
  231. package/lib/structures/GuildMember.ts +0 -193
  232. package/lib/structures/GuildScheduledEvent.ts +0 -164
  233. package/lib/structures/GuildTemplate.ts +0 -103
  234. package/lib/structures/Integration.ts +0 -136
  235. package/lib/structures/Interaction.ts +0 -506
  236. package/lib/structures/Invite.ts +0 -108
  237. package/lib/structures/Message.ts +0 -421
  238. package/lib/structures/Role.ts +0 -116
  239. package/lib/structures/SKU.ts +0 -63
  240. package/lib/structures/StageInstance.ts +0 -74
  241. package/lib/structures/Sticker.ts +0 -100
  242. package/lib/structures/Team.ts +0 -41
  243. package/lib/structures/TestEntitlement.ts +0 -78
  244. package/lib/structures/UnavailableGuild.ts +0 -27
  245. package/lib/structures/User.ts +0 -233
  246. package/lib/structures/VoiceState.ts +0 -72
  247. package/lib/structures/Webhook.ts +0 -341
  248. package/lib/structures/index.ts +0 -27
  249. package/lib/types/application-command.ts +0 -118
  250. package/lib/types/application-role-connection-metadata.ts +0 -23
  251. package/lib/types/application.ts +0 -77
  252. package/lib/types/audit-log.ts +0 -105
  253. package/lib/types/auto-moderation.ts +0 -78
  254. package/lib/types/channel.ts +0 -534
  255. package/lib/types/emoji.ts +0 -24
  256. package/lib/types/entitlements.ts +0 -34
  257. package/lib/types/gateway-events.ts +0 -970
  258. package/lib/types/guild-scheduled-event.ts +0 -67
  259. package/lib/types/guild-template.ts +0 -30
  260. package/lib/types/guild.ts +0 -388
  261. package/lib/types/index.ts +0 -23
  262. package/lib/types/interaction.ts +0 -224
  263. package/lib/types/invite.ts +0 -78
  264. package/lib/types/message-components.ts +0 -127
  265. package/lib/types/role.ts +0 -51
  266. package/lib/types/sku.ts +0 -32
  267. package/lib/types/stage-instance.ts +0 -22
  268. package/lib/types/sticker.ts +0 -67
  269. package/lib/types/team.ts +0 -34
  270. package/lib/types/user.ts +0 -93
  271. package/lib/types/voice.ts +0 -51
  272. package/lib/types/webhook.ts +0 -40
  273. package/lib/utils/Util.ts +0 -600
  274. package/lib/utils/errors.ts +0 -23
  275. package/lib/utils/index.ts +0 -2
  276. package/test/basic.js +0 -8
  277. package/tsconfig.json +0 -107
@@ -1,1095 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Guild = void 0;
4
- const _1 = require(".");
5
- const rest_1 = require("../rest");
6
- const undici_1 = require("undici");
7
- /** https://discord.com/developers/docs/resources/guild */
8
- class Guild extends _1.Base {
9
- raw;
10
- name;
11
- icon;
12
- iconHash;
13
- splash;
14
- discoverySplash;
15
- owner;
16
- ownerId;
17
- permissions;
18
- region;
19
- afkChannelId;
20
- afkTimeout;
21
- widgetEnabled;
22
- widgetChannelId;
23
- verificationLevel;
24
- defaultMessageNotifications;
25
- explicitContentFilter;
26
- roles;
27
- emojis;
28
- features;
29
- mfaLevel;
30
- applicationId;
31
- systemChannelId;
32
- systemChannelFlags;
33
- rulesChannelId;
34
- maxPresences;
35
- maxMembers;
36
- vanityURLCode;
37
- description;
38
- banner;
39
- premiumTier;
40
- premiumSubscriptionCount;
41
- preferredLocale;
42
- publicUpdatesChannelId;
43
- maxVideoChannelUsers;
44
- maxStageVideoChannelUsers;
45
- approximateMemberCount;
46
- approximatePresenceCount;
47
- welcomeScreen;
48
- nsfwLevel;
49
- stickers;
50
- premiumProgressBarEnabled;
51
- safetyAlertsChannelId;
52
- joinedAt;
53
- large;
54
- unavailable;
55
- memberCount;
56
- voiceStates;
57
- members;
58
- channels;
59
- threads;
60
- presences;
61
- stageInstances;
62
- guildScheduledEvents;
63
- constructor(data, client) {
64
- super(data.id, client);
65
- this.raw = data;
66
- this.name = data.name;
67
- this.icon = data.icon;
68
- this.splash = data.splash;
69
- this.discoverySplash = data.discovery_splash;
70
- this.ownerId = data.owner_id;
71
- this.afkChannelId = data.afk_channel_id;
72
- this.afkTimeout = data.afk_timeout;
73
- this.verificationLevel = data.verification_level;
74
- this.defaultMessageNotifications = data.default_message_notifications;
75
- this.explicitContentFilter = data.explicit_content_filter;
76
- this.roles = data.roles?.map((role) => new _1.Role(role, client));
77
- this.emojis = data.emojis?.map((emoji) => new _1.Emoji(emoji, client));
78
- this.features = data.features;
79
- this.mfaLevel = data.mfa_level;
80
- this.applicationId = data.application_id;
81
- this.systemChannelId = data.system_channel_id;
82
- this.systemChannelFlags = data.system_channel_flags;
83
- this.rulesChannelId = data.rules_channel_id;
84
- this.vanityURLCode = data.vanity_url_code;
85
- this.description = data.description;
86
- this.banner = data.banner;
87
- this.premiumTier = data.premium_tier;
88
- this.preferredLocale = data.preferred_locale;
89
- this.publicUpdatesChannelId = data.public_updates_channel_id;
90
- this.nsfwLevel = data.nsfw_level;
91
- this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
92
- this.safetyAlertsChannelId = data.safety_alerts_channel_id;
93
- this.patch(data);
94
- }
95
- patch(data) {
96
- if (data.icon_hash !== undefined)
97
- this.iconHash = data.icon_hash;
98
- if (data.owner !== undefined)
99
- this.owner = data.owner;
100
- if (data.permissions !== undefined)
101
- this.permissions = data.permissions;
102
- if (data.region !== undefined)
103
- this.region = data.region;
104
- if (data.widget_enabled !== undefined)
105
- this.widgetEnabled = data.widget_enabled;
106
- if (data.widget_channel_id !== undefined)
107
- this.widgetChannelId = data.widget_channel_id;
108
- if (data.max_presences !== undefined)
109
- this.maxPresences = data.max_presences;
110
- if (data.max_members !== undefined)
111
- this.maxMembers = data.max_members;
112
- if (data.premium_subscription_count !== undefined)
113
- this.premiumSubscriptionCount = data.premium_subscription_count;
114
- if (data.max_video_channel_users !== undefined)
115
- this.maxVideoChannelUsers = data.max_video_channel_users;
116
- if (data.max_stage_video_channel_users !== undefined)
117
- this.maxStageVideoChannelUsers = data.max_stage_video_channel_users;
118
- if (data.approximate_member_count !== undefined)
119
- this.approximateMemberCount = data.approximate_member_count;
120
- if (data.approximate_presence_count !== undefined)
121
- this.approximatePresenceCount = data.approximate_presence_count;
122
- if (data.welcome_screen !== undefined)
123
- this.welcomeScreen = {
124
- description: data.welcome_screen.description,
125
- welcomeChannels: data.welcome_screen.welcome_channels.map((welcomeChannel) => ({
126
- channelId: welcomeChannel.channel_id,
127
- description: welcomeChannel.description,
128
- emojiId: welcomeChannel.emoji_id,
129
- emojiName: welcomeChannel.emoji_name,
130
- })),
131
- };
132
- if (data.stickers !== undefined)
133
- this.stickers = data.stickers.map((data) => new _1.Sticker(data, this.client));
134
- if (data.joined_at !== undefined)
135
- this.joinedAt = data.joined_at;
136
- if (data.large !== undefined)
137
- this.large = data.large;
138
- if (data.unavailable !== undefined)
139
- this.unavailable = data.unavailable;
140
- if (data.member_count !== undefined)
141
- this.memberCount = data.member_count;
142
- if (data.voice_states !== undefined)
143
- this.voiceStates = data.voice_states.map((voiceState) => new _1.VoiceState(voiceState, this.client));
144
- if (data.members !== undefined)
145
- this.members = data.members.map((member) => new _1.GuildMember(member, this.client));
146
- if (data.channels !== undefined)
147
- this.channels = data.channels.map((channel) => new _1.Channel(channel, this.client));
148
- if (data.threads !== undefined)
149
- this.threads = data.threads.map((thread) => new _1.Channel(thread, this.client));
150
- if (data.presences !== undefined)
151
- this.presences = data.presences.map((presence) => this.client.util.presenceToREST(presence, this.client));
152
- if (data.stage_instances !== undefined)
153
- this.stageInstances = data.stage_instances.map((stageIntance) => new _1.StageInstance(stageIntance, this.client));
154
- if (data.guild_scheduled_events !== undefined)
155
- this.guildScheduledEvents = data.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client));
156
- }
157
- /** https://discord.com/developers/docs/resources/guild#add-guild-member */
158
- async addMember(userId, options) {
159
- return this.client.rest
160
- .put(rest_1.Endpoints.guildMember(this.id, userId), {
161
- json: {
162
- access_token: options.accessToken,
163
- nick: options.nick,
164
- roles: options.roles,
165
- mute: options.mute,
166
- deaf: options.deaf,
167
- },
168
- })
169
- .then((response) => {
170
- if (response !== null) {
171
- return new _1.GuildMember(response, this.client);
172
- }
173
- else
174
- return null;
175
- });
176
- }
177
- /** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
178
- addMemberRole(userId, roleId, reason) {
179
- this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
180
- reason,
181
- });
182
- }
183
- /** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
184
- async beginGuildPrune(options, reason) {
185
- return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
186
- json: {
187
- days: options.days,
188
- compute_prune_count: options.computePruneCount,
189
- include_roles: options.includeRoles,
190
- reason: options.reason,
191
- },
192
- reason,
193
- });
194
- }
195
- /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
196
- async createApplicationCommand(applicationId, options) {
197
- return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
198
- json: this.client.util.applicationCommandToRaw(options),
199
- }), this.client);
200
- }
201
- /** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
202
- async createAutoModerationRule(options, reason) {
203
- return new _1.AutoModerationRule(await this.client.rest.post(rest_1.Endpoints.guildAutoModerationRules(this.id), {
204
- json: {
205
- name: options.name,
206
- event_type: options.eventType,
207
- trigger_type: options.triggerType,
208
- trigger_metadata: options.triggerMetadata,
209
- actions: options.actions.map((action) => ({
210
- type: action.type,
211
- metadata: {
212
- channel_id: action.metadata.channelId,
213
- duration_seconds: action.metadata.durationSeconds,
214
- custom_message: action.metadata.customMessage,
215
- },
216
- })),
217
- enabled: options.enabled,
218
- exempt_roles: options.exemptRoles,
219
- exempt_channels: options.exemptChannels,
220
- },
221
- reason,
222
- }), this.client);
223
- }
224
- /** https://discord.com/developers/docs/resources/guild#create-guild-ban */
225
- createBan(userId, options, reason) {
226
- this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
227
- json: {
228
- delete_message_days: options?.deleteMessageDays,
229
- delete_message_seconds: options?.deleteMessageSeconds,
230
- },
231
- reason,
232
- });
233
- }
234
- /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
235
- async createChannel(options, reason) {
236
- return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
237
- json: {
238
- name: options.name,
239
- type: options.type,
240
- topic: options.topic,
241
- bitrate: options.bitrate,
242
- user_limit: options.userLimit,
243
- rate_limit_per_user: options.rateLimitPerUser,
244
- position: options.position,
245
- permission_overwrites: options.permissionOverwrites,
246
- parent_id: options.parentId,
247
- nsfw: options.nsfw,
248
- rtc_region: options.rtcRegion,
249
- video_quality_mode: options.videoQualityMode,
250
- default_auto_archive_duration: options.defaultAutoArchiveDuration,
251
- default_reaction_emoji: {
252
- emojiId: options.defaultReactionEmoji?.emojiId,
253
- emojiName: options.defaultReactionEmoji?.emojiName,
254
- },
255
- available_tags: options.availableTags,
256
- default_sort_order: options.defaultSortOrder,
257
- default_forum_layout: options.defaultForumLayout,
258
- default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
259
- },
260
- reason,
261
- }), this.client);
262
- }
263
- /** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
264
- async createEmoji(options, reason) {
265
- return new _1.Emoji(await this.client.rest.post(rest_1.Endpoints.guildEmojis(this.id), {
266
- json: {
267
- name: options.name,
268
- image: options.image,
269
- roles: options.roles,
270
- },
271
- reason,
272
- }), this.client);
273
- }
274
- /** https://discord.com/developers/docs/resources/guild#create-guild-role */
275
- async createRole(options, reason) {
276
- return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
277
- json: {
278
- name: options.name,
279
- permissions: options.permissions,
280
- color: options.color,
281
- hoist: options.hoist,
282
- icon: options.icon,
283
- unicode_emoji: options.unicodeEmoji,
284
- mentionable: options.mentionable,
285
- },
286
- reason,
287
- }), this.client);
288
- }
289
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
290
- async createScheduledEvent(options, reason) {
291
- return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
292
- json: {
293
- channel_id: options.channelId,
294
- entity_metadata: options.entityMetadata,
295
- name: options.name,
296
- privacy_level: options.privacyLevel,
297
- scheduled_start_time: options.scheduledEndTime,
298
- scheduled_end_time: options.scheduledEndTime,
299
- description: options.description,
300
- entity_type: options.entityType,
301
- image: options.image,
302
- },
303
- reason,
304
- }), this.client);
305
- }
306
- /** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
307
- async createSticker(options, reason) {
308
- const formData = new undici_1.FormData();
309
- formData.set("name", options.name);
310
- formData.set("description", options.description);
311
- formData.set("tags", options.tags);
312
- formData.set("file", new undici_1.File([options.file.contents], options.file.name));
313
- return this.client.rest
314
- .post(rest_1.Endpoints.guildStickers(this.id), {
315
- form: formData,
316
- reason,
317
- })
318
- .then((response) => new _1.Sticker(response, this.client));
319
- }
320
- /** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
321
- async createTemplate(options) {
322
- return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
323
- json: {
324
- name: options.name,
325
- description: options.description,
326
- },
327
- }), this.client);
328
- }
329
- /** https://discord.com/developers/docs/resources/guild#delete-guild */
330
- delete() {
331
- this.client.rest.delete(rest_1.Endpoints.guild(this.id));
332
- }
333
- /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
334
- deleteApplicationCommand(applicationId, commandId) {
335
- this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
336
- }
337
- /** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
338
- deleteAutoModerationRule(ruleId, reason) {
339
- this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
340
- reason,
341
- });
342
- }
343
- /** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
344
- deleteEmoji(emojiId, reason) {
345
- this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
346
- reason,
347
- });
348
- }
349
- /** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
350
- deleteIntegration(integrationId, reason) {
351
- this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
352
- reason,
353
- });
354
- }
355
- /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
356
- deleteRole(roleId, reason) {
357
- this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
358
- reason,
359
- });
360
- }
361
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
362
- deleteScheduledEvent(scheduledEventId) {
363
- this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
364
- }
365
- /** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
366
- deleteSticker(stickerId, reason) {
367
- this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
368
- reason,
369
- });
370
- }
371
- /** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
372
- async deleteTemplate(code) {
373
- return this.client.rest
374
- .delete(rest_1.Endpoints.guildTemplate(this.id, code))
375
- .then((response) => new _1.GuildTemplate(response, this.client).toJSON());
376
- }
377
- /** https://discord.com/developers/docs/resources/guild#modify-guild */
378
- async edit(options, reason) {
379
- return new Guild(await this.client.rest.patch(rest_1.Endpoints.guild(this.id), {
380
- json: {
381
- name: options.name,
382
- region: options.region,
383
- verification_level: options.verificationLevel,
384
- default_message_notifications: options.defaultMessageNotifications,
385
- explicit_content_filter: options.explicitContentFilter,
386
- afk_channel_id: options.afkChannelId,
387
- afk_timeout: options.afkTimeout,
388
- icon: options.icon,
389
- owner_id: options.ownerId,
390
- splash: options.splash,
391
- discovery_splash: options.discoverySplash,
392
- banner: options.banner,
393
- system_channel_id: options.systemChannelId,
394
- system_channel_flags: options.systemChannelFlags,
395
- rules_channel_id: options.rulesChannelId,
396
- public_updates_channel_id: options.publicUpdatesChannelId,
397
- preferred_locale: options.preferredLocale,
398
- features: options.features,
399
- description: options.description,
400
- premium_progress_bar_enabled: options.premiumProgressBarEnabled,
401
- safety_alerts_channel_id: options.safetyAlertsChannelId,
402
- },
403
- reason,
404
- }), this.client);
405
- }
406
- /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
407
- async editApplicationCommand(applicationId, commandId, options) {
408
- return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
409
- json: this.client.util.applicationCommandToRaw(options),
410
- }), this.client);
411
- }
412
- /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
413
- async editAutoModerationRule(ruleId, options, reason) {
414
- return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
415
- json: {
416
- name: options.name,
417
- event_type: options.eventType,
418
- trigger_type: options.triggerType,
419
- trigger_metadata: options.triggerMetadata,
420
- actions: options.actions?.map((action) => ({
421
- type: action.type,
422
- metadata: {
423
- channel_id: action.metadata.channelId,
424
- duration_seconds: action.metadata.durationSeconds,
425
- custom_message: action.metadata.customMessage,
426
- },
427
- })),
428
- enabled: options.enabled,
429
- exempt_roles: options.exemptRoles,
430
- exempt_channels: options.exemptChannels,
431
- },
432
- reason,
433
- }), this.client);
434
- }
435
- /** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
436
- editChannelPositions(options) {
437
- this.client.rest.patch(rest_1.Endpoints.guildChannels(this.id), {
438
- json: options.map((data) => ({
439
- id: data.id,
440
- position: data.position,
441
- lock_permissions: data.lockPermissions,
442
- parent_id: data.parentId,
443
- })),
444
- });
445
- }
446
- /** https://discord.com/developers/docs/resources/guild#modify-current-member */
447
- async editCurrentMember(options, reason) {
448
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
449
- json: {
450
- nick: options.nick,
451
- },
452
- reason,
453
- }), this.client);
454
- }
455
- /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
456
- editCurrentUserVoiceState(options) {
457
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
458
- json: {
459
- channel_id: options.channelId,
460
- suppress: options.suppress,
461
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
462
- },
463
- });
464
- }
465
- /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
466
- async editEmoji(emojiId, options, reason) {
467
- return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
468
- json: {
469
- name: options.name,
470
- roles: options.roles,
471
- },
472
- reason,
473
- }), this.client);
474
- }
475
- /** https://discord.com/developers/docs/resources/guild#modify-guild-member */
476
- async editMember(userId, options, reason) {
477
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id, userId), {
478
- json: {
479
- nick: options.nick,
480
- roles: options.roles,
481
- mute: options.mute,
482
- deaf: options.deaf,
483
- channel_id: options.channelId,
484
- communication_disabled_until: options.communicationDisabledUntil,
485
- flags: options.flags,
486
- },
487
- reason,
488
- }), this.client);
489
- }
490
- /** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
491
- async editMFALevel(options, reason) {
492
- return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
493
- json: {
494
- level: options.level,
495
- },
496
- reason,
497
- });
498
- }
499
- /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
500
- editOnboarding(options, reason) {
501
- this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
502
- json: {
503
- prompts: options.prompts.map((prompt) => ({
504
- id: prompt.id,
505
- type: prompt.type,
506
- options: prompt.options.map((option) => ({
507
- id: option.id,
508
- channel_ids: option.channelIds,
509
- role_ids: option.roleIds,
510
- emoji: option.emoji !== undefined
511
- ? {
512
- id: option.emoji.id,
513
- name: option.emoji.name,
514
- roles: option.emoji.roles,
515
- user: option.emoji.user,
516
- require_colons: option.emoji.requireColons,
517
- managed: option.emoji.managed,
518
- animated: option.emoji.animated,
519
- available: option.emoji.available,
520
- }
521
- : undefined,
522
- emoji_id: option.emojiId,
523
- emoji_name: option.emojiName,
524
- emoji_animated: option.emojiAnimated,
525
- title: option.title,
526
- description: option.description,
527
- })),
528
- title: prompt.title,
529
- single_select: prompt.singleSelect,
530
- required: prompt.required,
531
- in_onboarding: prompt.inOnboarding,
532
- })),
533
- },
534
- reason,
535
- });
536
- }
537
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
538
- async editRole(roleId, options, reason) {
539
- return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
540
- json: {
541
- name: options?.name,
542
- permissions: options?.permissions,
543
- color: options?.color,
544
- hoist: options?.hoist,
545
- icon: options?.icon,
546
- unicode_emoji: options?.unicodeEmoji,
547
- mentionable: options?.mentionable,
548
- },
549
- reason,
550
- }), this.client);
551
- }
552
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
553
- async editRolePositions(options) {
554
- return this.client.rest
555
- .patch(rest_1.Endpoints.guildRoles(this.id), {
556
- json: options.map((data) => ({
557
- id: data.id,
558
- position: data.position,
559
- })),
560
- })
561
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
562
- }
563
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
564
- async editScheduledEvent(scheduledEventId, options, reason) {
565
- return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
566
- json: {
567
- channel_id: options.channelId,
568
- entity_metadata: options.entityMetadata,
569
- name: options.name,
570
- privacy_level: options.privacyLevel,
571
- scheduled_start_time: options.scheduledStartTime,
572
- scheduled_end_time: options.scheduledEndTime,
573
- description: options.description,
574
- entityType: options.entityType,
575
- status: options.status,
576
- image: options.image,
577
- },
578
- reason,
579
- }), this.client);
580
- }
581
- /** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
582
- async editSticker(stickerId, options, reason) {
583
- return this.client.rest
584
- .patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
585
- json: {
586
- name: options.name,
587
- description: options.description,
588
- tags: options.tags,
589
- },
590
- reason,
591
- })
592
- .then((response) => new _1.Sticker(response, this.client));
593
- }
594
- /** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
595
- async editTemplate(code, options) {
596
- return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
597
- json: {
598
- name: options.name,
599
- description: options.description,
600
- },
601
- }), this.client);
602
- }
603
- /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
604
- editUserVoiceState(userId, options) {
605
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
606
- json: {
607
- channel_id: options.channelId,
608
- suppress: options.suppress,
609
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
610
- },
611
- });
612
- }
613
- /** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
614
- async editWelcomeScreen(options, reason) {
615
- return this.client.rest
616
- .patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
617
- json: {
618
- enabled: options.enabled,
619
- welcome_channels: options.welcomeChannels,
620
- description: options.description,
621
- },
622
- reason,
623
- })
624
- .then((response) => ({
625
- description: response.description,
626
- welcomeChannels: response.welcome_channels.map((data) => ({
627
- channelId: data.channel_id,
628
- description: data.description,
629
- emojiId: data.emoji_id,
630
- emojiName: data.emoji_name,
631
- })),
632
- }));
633
- }
634
- /** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
635
- async editWidget(options, reason) {
636
- return this.client.rest
637
- .patch(rest_1.Endpoints.guildWidgetSettings(this.id), {
638
- json: {
639
- enabled: options.enabled,
640
- channel_id: options.channelId,
641
- },
642
- reason,
643
- })
644
- .then((response) => ({
645
- enabled: response.enabled,
646
- channelId: response.channel_id,
647
- }));
648
- }
649
- /** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
650
- async getActiveThreads() {
651
- return this.client.rest
652
- .get(rest_1.Endpoints.guildActiveThreads(this.id))
653
- .then((response) => response.map((data) => ({
654
- threads: data.threads.map((data) => new _1.Channel(data, this.client)),
655
- members: data.members.map((data) => ({
656
- id: data.id,
657
- userId: data.user_id,
658
- joinTimestamp: data.join_timestamp,
659
- flags: data.flags,
660
- member: data.member !== undefined
661
- ? new _1.GuildMember(data.member, this.client)
662
- : undefined,
663
- })),
664
- })));
665
- }
666
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
667
- async getApplicationCommand(applicationId, commandId) {
668
- return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
669
- }
670
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
671
- async getApplicationCommands(applicationId, options) {
672
- return this.client.rest
673
- .get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
674
- query: {
675
- with_localizations: options?.withLocalizations,
676
- },
677
- })
678
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
679
- }
680
- /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
681
- async getApplicationCommandPermissions(applicationId, commandId) {
682
- return this.client.rest
683
- .get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
684
- .then((response) => response.map((permissions) => ({
685
- id: permissions.id,
686
- applicationId: permissions.application_id,
687
- guildId: permissions.guild_id,
688
- permissions: permissions.permissions.map((permission) => ({
689
- id: permission.id,
690
- type: permission.type,
691
- permission: permission.permission,
692
- })),
693
- })));
694
- }
695
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
696
- async getApplicationCommandsPermissions(applicationId) {
697
- return this.client.rest
698
- .get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
699
- .then((response) => response.map((permissions) => ({
700
- id: permissions.id,
701
- applicationId: permissions.application_id,
702
- guildId: permissions.guild_id,
703
- permissions: permissions.permissions.map((permission) => ({
704
- id: permission.id,
705
- type: permission.type,
706
- permission: permission.permission,
707
- })),
708
- })));
709
- }
710
- /** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
711
- async getAuditLog(options) {
712
- return new _1.AuditLog(await this.client.rest.get(rest_1.Endpoints.guildAuditLog(this.id), {
713
- query: {
714
- user_id: options?.userId,
715
- action_type: options?.actionType,
716
- before: options?.before,
717
- after: options?.after,
718
- limit: options?.limit,
719
- },
720
- }), this.client);
721
- }
722
- /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
723
- async getAutoModerationRule(ruleId) {
724
- return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
725
- }
726
- /** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
727
- async getAutoModerationRules() {
728
- return this.client.rest
729
- .get(rest_1.Endpoints.guildAutoModerationRules(this.id))
730
- .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
731
- }
732
- /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
733
- async getBan(userId) {
734
- return this.client.rest
735
- .get(rest_1.Endpoints.guildBan(this.id, userId))
736
- .then((response) => ({
737
- reason: response.reason,
738
- user: new _1.User(response.user, this.client),
739
- }));
740
- }
741
- /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
742
- async getBans(options) {
743
- return this.client.rest
744
- .get(rest_1.Endpoints.guildBans(this.id), {
745
- query: {
746
- limit: options?.limit,
747
- before: options?.before,
748
- after: options?.after,
749
- },
750
- })
751
- .then((response) => response.map((data) => ({
752
- reason: data.reason,
753
- user: new _1.User(data.user, this.client).toJSON(),
754
- })));
755
- }
756
- /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
757
- async getChannels() {
758
- return this.client.rest
759
- .get(rest_1.Endpoints.guildChannels(this.id))
760
- .then((response) => response.map((data) => new _1.Channel(data, this.client)));
761
- }
762
- /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
763
- async getEmoji(emojiId) {
764
- return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
765
- }
766
- /** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
767
- async getEmojis() {
768
- return this.client.rest
769
- .get(rest_1.Endpoints.guildEmojis(this.id))
770
- .then((response) => response.map((data) => new _1.Emoji(data, this.client)));
771
- }
772
- /** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
773
- async getIntegrations() {
774
- return this.client.rest
775
- .get(rest_1.Endpoints.guildIntegrations(this.id))
776
- .then((response) => response.map((data) => new _1.Integration(data, this.client)));
777
- }
778
- /** https://discord.com/developers/docs/resources/guild#get-guild-invites */
779
- async getInvites() {
780
- return this.client.rest
781
- .get(rest_1.Endpoints.guildInvites(this.id))
782
- .then((response) => response.map((data) => new _1.Invite(data, this.client)));
783
- }
784
- /** https://discord.com/developers/docs/resources/guild#get-guild-member */
785
- async getMember(userId) {
786
- return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
787
- }
788
- /** https://discord.com/developers/docs/resources/guild#list-guild-members */
789
- async getMembers() {
790
- return this.client.rest
791
- .get(rest_1.Endpoints.guildMembers(this.id))
792
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
793
- }
794
- /** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
795
- async getOnboarding() {
796
- return this.client.rest
797
- .get(rest_1.Endpoints.guildOnboarding(this.id))
798
- .then((response) => ({
799
- guildId: response.guild_id,
800
- prompts: response.prompts.map((prompt) => ({
801
- id: prompt.id,
802
- type: prompt.type,
803
- options: prompt.options.map((option) => ({
804
- id: option.id,
805
- channelIds: option.channel_ids,
806
- roleIds: option.role_ids,
807
- emoji: option.emoji !== undefined
808
- ? new _1.Emoji(option.emoji, this.client)
809
- : undefined,
810
- emojiId: option.emoji_id,
811
- emojiName: option.emoji_name,
812
- emojiAnimated: option.emoji_animated,
813
- title: option.title,
814
- description: option.description,
815
- })),
816
- title: prompt.title,
817
- singleSelect: prompt.single_select,
818
- required: prompt.required,
819
- inOnboarding: prompt.in_onboarding,
820
- })),
821
- defaultChannelIds: response.default_channel_ids,
822
- enabled: response.enabled,
823
- mode: response.mode,
824
- }));
825
- }
826
- /** https://discord.com/developers/docs/resources/guild#get-guild-preview */
827
- async getPreview() {
828
- return this.client.rest
829
- .get(rest_1.Endpoints.guildPreview(this.id))
830
- .then((response) => ({
831
- id: response.id,
832
- name: response.name,
833
- icon: response.icon,
834
- splash: response.splash,
835
- discoverySplash: response.discovery_splash,
836
- emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
837
- features: response.features,
838
- approximateMemberCount: response.approximate_member_count,
839
- approximatePresenceCount: response.approximate_presence_count,
840
- description: response.description,
841
- stickers: response.stickers?.map((sticker) => ({
842
- id: sticker.id,
843
- packId: sticker.pack_id,
844
- name: sticker.name,
845
- description: sticker.description,
846
- tags: sticker.tags,
847
- asset: sticker.asset,
848
- type: sticker.type,
849
- formatType: sticker.format_type,
850
- available: sticker.available,
851
- guildId: sticker.guild_id,
852
- user: sticker.user !== undefined
853
- ? new _1.User(sticker.user, this.client)
854
- : undefined,
855
- sortValue: sticker.sort_value,
856
- })),
857
- }));
858
- }
859
- /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
860
- async getPruneCount(options) {
861
- return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
862
- query: {
863
- days: options.days,
864
- include_roles: options.includeRoles,
865
- },
866
- });
867
- }
868
- /** https://discord.com/developers/docs/resources/guild#get-guild-roles */
869
- async getRoles() {
870
- return this.client.rest
871
- .get(rest_1.Endpoints.guildRoles(this.id))
872
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
873
- }
874
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
875
- async getScheduledEvents(options) {
876
- return this.client.rest
877
- .get(rest_1.Endpoints.guildScheduledEvents(this.id), {
878
- query: {
879
- with_user_count: options?.withUserCount,
880
- },
881
- })
882
- .then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
883
- }
884
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
885
- async getScheduledEventUsers(scheduledEventId, options) {
886
- return this.client.rest
887
- .get(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
888
- query: {
889
- limit: options?.limit,
890
- with_member: options?.withMember,
891
- before: options?.before,
892
- after: options?.after,
893
- },
894
- })
895
- .then((response) => response.map((data) => ({
896
- guildScheduledEventId: data.guild_scheduled_event_id,
897
- user: new _1.User(data.user, this.client).toJSON(),
898
- member: data.member !== undefined
899
- ? new _1.GuildMember(data.member, this.client).toJSON()
900
- : undefined,
901
- })));
902
- }
903
- /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
904
- async getSticker(stickerId) {
905
- return this.client.rest
906
- .get(rest_1.Endpoints.guildSticker(this.id, stickerId))
907
- .then((response) => new _1.Sticker(response, this.client));
908
- }
909
- /** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
910
- async getStickers() {
911
- return this.client.rest
912
- .get(rest_1.Endpoints.guildStickers(this.id))
913
- .then((response) => response.map((data) => new _1.Sticker(data, this.client)));
914
- }
915
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
916
- async getTemplate(code) {
917
- return new _1.GuildTemplate(await this.client.rest.get(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
918
- }
919
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
920
- async getTemplates() {
921
- return this.client.rest
922
- .get(rest_1.Endpoints.guildTemplates(this.id))
923
- .then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
924
- }
925
- /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
926
- getVanityURL() {
927
- return this.client.rest.get(rest_1.Endpoints.guildVanityURL(this.id));
928
- }
929
- /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
930
- async getVoiceRegions() {
931
- return this.client.rest
932
- .get(rest_1.Endpoints.guildVoiceRegions(this.id))
933
- .then((response) => response.map((data) => ({
934
- id: data.id,
935
- name: data.name,
936
- optimal: data.optimal,
937
- deprecated: data.deprecated,
938
- custom: data.custom,
939
- })));
940
- }
941
- /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
942
- async getWebhooks() {
943
- return this.client.rest
944
- .get(rest_1.Endpoints.guildWebhooks(this.id))
945
- .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
946
- }
947
- /** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
948
- async getWelcomeScreen() {
949
- return this.client.rest
950
- .get(rest_1.Endpoints.guildWelcomeScreen(this.id))
951
- .then((response) => ({
952
- description: response.description,
953
- welcomeChannels: response.welcome_channels.map((data) => ({
954
- channelId: data.channel_id,
955
- description: data.description,
956
- emojiId: data.emoji_id,
957
- emojiName: data.emoji_name,
958
- })),
959
- }));
960
- }
961
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget */
962
- async getWidget() {
963
- return this.client.rest
964
- .get(rest_1.Endpoints.guildWidgetJSON(this.id))
965
- .then((response) => ({
966
- id: response.id,
967
- name: response.name,
968
- instantInvite: response.instant_invite,
969
- channels: response.channels.map((data) => new _1.Channel(data, this.client)),
970
- members: response.members.map((data) => new _1.User(data, this.client)),
971
- presenceCount: response.presence_count,
972
- }));
973
- }
974
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
975
- async getWidgetImage(options) {
976
- return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
977
- query: {
978
- style: options?.style,
979
- },
980
- });
981
- }
982
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
983
- async getWidgetSettings() {
984
- return this.client.rest
985
- .get(rest_1.Endpoints.guildWidgetSettings(this.id))
986
- .then((response) => ({
987
- enabled: response.enabled,
988
- channelId: response.channel_id,
989
- }));
990
- }
991
- /** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
992
- removeBan(userId, reason) {
993
- this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
994
- reason,
995
- });
996
- }
997
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member */
998
- removeMember(userId, reason) {
999
- this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
1000
- reason,
1001
- });
1002
- }
1003
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
1004
- removeMemberRole(userId, roleId, reason) {
1005
- this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
1006
- reason,
1007
- });
1008
- }
1009
- /** https://discord.com/developers/docs/resources/guild#search-guild-members */
1010
- async searchMembers(options) {
1011
- return this.client.rest
1012
- .get(rest_1.Endpoints.guildMembersSearch(this.id), {
1013
- query: {
1014
- query: options.query,
1015
- limit: options.limit,
1016
- },
1017
- })
1018
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
1019
- }
1020
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
1021
- async setApplicationCommands(applicationId, commands) {
1022
- return this.client.rest
1023
- .put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
1024
- json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
1025
- })
1026
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
1027
- }
1028
- /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
1029
- async syncTemplate(code) {
1030
- return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
1031
- }
1032
- toRaw() {
1033
- return this.raw;
1034
- }
1035
- toJSON() {
1036
- return {
1037
- ...super.toJSON(),
1038
- name: this.name,
1039
- icon: this.icon,
1040
- iconHash: this.iconHash,
1041
- splash: this.splash,
1042
- discoverySplash: this.discoverySplash,
1043
- owner: this.owner,
1044
- ownerId: this.ownerId,
1045
- permissions: this.permissions,
1046
- region: this.region,
1047
- afkChannelId: this.afkChannelId,
1048
- afkTimeout: this.afkTimeout,
1049
- widgetEnabled: this.widgetEnabled,
1050
- widgetChannelId: this.widgetChannelId,
1051
- verificationLevel: this.verificationLevel,
1052
- defaultMessageNotifications: this.defaultMessageNotifications,
1053
- explicitContentFilter: this.explicitContentFilter,
1054
- roles: this.roles,
1055
- emojis: this.emojis,
1056
- features: this.features,
1057
- mfaLevel: this.mfaLevel,
1058
- applicationId: this.applicationId,
1059
- systemChannelId: this.systemChannelId,
1060
- systemChannelFlags: this.systemChannelFlags,
1061
- rulesChannelId: this.rulesChannelId,
1062
- maxPresences: this.maxPresences,
1063
- maxMembers: this.maxMembers,
1064
- vanityURLCode: this.vanityURLCode,
1065
- description: this.description,
1066
- banner: this.banner,
1067
- premiumTier: this.premiumTier,
1068
- premiumSubscriptionCount: this.premiumSubscriptionCount,
1069
- preferredLocale: this.preferredLocale,
1070
- publicUpdatesChannelId: this.publicUpdatesChannelId,
1071
- maxVideoChannelUsers: this.maxVideoChannelUsers,
1072
- maxStageVideoChannelUsers: this.maxStageVideoChannelUsers,
1073
- approximateMemberCount: this.approximateMemberCount,
1074
- approximatePresenceCount: this.approximatePresenceCount,
1075
- welcomeScreen: this.welcomeScreen,
1076
- nsfwLevel: this.nsfwLevel,
1077
- stickers: this.stickers,
1078
- premiumProgressBarEnabled: this.premiumProgressBarEnabled,
1079
- safetyAlertsChannelId: this.safetyAlertsChannelId,
1080
- joinedAt: this.joinedAt,
1081
- large: this.large,
1082
- unavailable: this.unavailable,
1083
- memberCount: this.memberCount,
1084
- voiceStates: this.voiceStates?.map((voiceState) => voiceState.toJSON()),
1085
- members: this.members?.map((member) => member.toJSON()),
1086
- channels: this.channels?.map((channel) => channel.toJSON()),
1087
- threads: this.threads?.map((thread) => thread.toJSON()),
1088
- presences: this.presences,
1089
- stageInstances: this.stageInstances?.map((stageInstance) => stageInstance.toJSON()),
1090
- guildScheduledEvents: this.guildScheduledEvents?.map((guildScheduledEvent) => guildScheduledEvent.toJSON()),
1091
- };
1092
- }
1093
- }
1094
- exports.Guild = Guild;
1095
- //# sourceMappingURL=Guild.js.map