seyfert 2.2.1-dev-12726380923.0 → 2.2.1-dev-12801030016.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,7 @@ export declare class GuildShorter extends BaseShorter {
31
31
  /**
32
32
  * Provides access to channel-related functionality in a guild.
33
33
  */
34
- get channels(): {
34
+ channels: {
35
35
  /**
36
36
  * Retrieves a list of channels in the guild.
37
37
  * @param guildId The ID of the guild.
@@ -82,7 +82,7 @@ export declare class GuildShorter extends BaseShorter {
82
82
  /**
83
83
  * Provides access to auto-moderation rule-related functionality in a guild.
84
84
  */
85
- get moderation(): {
85
+ moderation: {
86
86
  /**
87
87
  * Retrieves a list of auto-moderation rules in the guild.
88
88
  * @param guildId The ID of the guild.
@@ -124,7 +124,7 @@ export declare class GuildShorter extends BaseShorter {
124
124
  /**
125
125
  * Provides access to sticker-related functionality in a guild.
126
126
  */
127
- get stickers(): {
127
+ stickers: {
128
128
  /**
129
129
  * Retrieves a list of stickers in the guild.
130
130
  * @param guildId The ID of the guild.
@@ -77,229 +77,223 @@ class GuildShorter extends base_1.BaseShorter {
77
77
  /**
78
78
  * Provides access to channel-related functionality in a guild.
79
79
  */
80
- get channels() {
81
- return {
82
- /**
83
- * Retrieves a list of channels in the guild.
84
- * @param guildId The ID of the guild.
85
- * @param force Whether to force fetching channels from the API even if they exist in the cache.
86
- * @returns A Promise that resolves to an array of channels.
87
- */
88
- list: async (guildId, force = false) => {
89
- let channels;
90
- if (!force) {
91
- channels = (await this.client.cache.channels?.values(guildId)) ?? [];
92
- if (channels.length) {
93
- return channels;
94
- }
80
+ channels = {
81
+ /**
82
+ * Retrieves a list of channels in the guild.
83
+ * @param guildId The ID of the guild.
84
+ * @param force Whether to force fetching channels from the API even if they exist in the cache.
85
+ * @returns A Promise that resolves to an array of channels.
86
+ */
87
+ list: async (guildId, force = false) => {
88
+ let channels;
89
+ if (!force) {
90
+ channels = (await this.client.cache.channels?.values(guildId)) ?? [];
91
+ if (channels.length) {
92
+ return channels;
95
93
  }
96
- channels = await this.client.proxy.guilds(guildId).channels.get();
97
- await this.client.cache.channels?.set(cache_1.CacheFrom.Rest, channels.map(x => [x.id, x]), guildId);
98
- return channels.map(m => (0, structures_1.channelFrom)(m, this.client));
99
- },
100
- /**
101
- * Fetches a channel by its ID.
102
- * @param guildId The ID of the guild.
103
- * @param channelId The ID of the channel to fetch.
104
- * @param force Whether to force fetching the channel from the API even if it exists in the cache.
105
- * @returns A Promise that resolves to the fetched channel.
106
- */
107
- fetch: async (guildId, channelId, force) => {
108
- let channel;
109
- if (!force) {
110
- channel = await this.client.cache.channels?.get(channelId);
111
- if (channel)
112
- return channel;
113
- }
114
- channel = await this.client.proxy.channels(channelId).get();
115
- await this.client.cache.channels?.patch(cache_1.CacheFrom.Rest, channelId, guildId, channel);
116
- return (0, structures_1.channelFrom)(channel, this.client);
117
- },
118
- /**
119
- * Creates a new channel in the guild.
120
- * @param guildId The ID of the guild.
121
- * @param body The data for creating the channel.
122
- * @returns A Promise that resolves to the created channel.
123
- */
124
- create: async (guildId, body) => {
125
- const res = await this.client.proxy.guilds(guildId).channels.post({ body });
126
- await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildId), res.id, guildId, res);
127
- return (0, structures_1.channelFrom)(res, this.client);
128
- },
129
- /**
130
- * Deletes a channel from the guild.
131
- * @param guildId The ID of the guild.
132
- * @param channelId The ID of the channel to delete.
133
- * @param reason The reason for deleting the channel.
134
- * @returns A Promise that resolves to the deleted channel.
135
- */
136
- delete: async (guildId, channelId, reason) => {
137
- const res = await this.client.proxy.channels(channelId).delete({ reason });
138
- await this.client.cache.channels?.removeIfNI(structures_1.BaseChannel.__intent__(guildId), res.id, guildId);
139
- return (0, structures_1.channelFrom)(res, this.client);
140
- },
141
- /**
142
- * Edits a channel in the guild.
143
- * @param guildchannelId The ID of the guild.
144
- * @param channelId The ID of the channel to edit.
145
- * @param body The data to update the channel with.
146
- * @param reason The reason for editing the channel.
147
- * @returns A Promise that resolves to the edited channel.
148
- */
149
- edit: async (guildchannelId, channelId, body, reason) => {
150
- const res = await this.client.proxy.channels(channelId).patch({ body, reason });
151
- await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildchannelId), res.id, guildchannelId, res);
152
- return (0, structures_1.channelFrom)(res, this.client);
153
- },
154
- /**
155
- * Edits the positions of channels in the guild.
156
- * @param guildId The ID of the guild.
157
- * @param body The data containing the new positions of channels.
158
- */
159
- editPositions: (guildId, body) => this.client.proxy.guilds(guildId).channels.patch({ body }),
160
- addFollower: async (channelId, webhook_channel_id, reason) => {
161
- return this.client.proxy.channels(channelId).followers.post({
162
- body: {
163
- webhook_channel_id,
164
- },
165
- reason,
166
- });
167
- },
168
- };
169
- }
94
+ }
95
+ channels = await this.client.proxy.guilds(guildId).channels.get();
96
+ await this.client.cache.channels?.set(cache_1.CacheFrom.Rest, channels.map(x => [x.id, x]), guildId);
97
+ return channels.map(m => (0, structures_1.channelFrom)(m, this.client));
98
+ },
99
+ /**
100
+ * Fetches a channel by its ID.
101
+ * @param guildId The ID of the guild.
102
+ * @param channelId The ID of the channel to fetch.
103
+ * @param force Whether to force fetching the channel from the API even if it exists in the cache.
104
+ * @returns A Promise that resolves to the fetched channel.
105
+ */
106
+ fetch: async (guildId, channelId, force) => {
107
+ let channel;
108
+ if (!force) {
109
+ channel = await this.client.cache.channels?.get(channelId);
110
+ if (channel)
111
+ return channel;
112
+ }
113
+ channel = await this.client.proxy.channels(channelId).get();
114
+ await this.client.cache.channels?.patch(cache_1.CacheFrom.Rest, channelId, guildId, channel);
115
+ return (0, structures_1.channelFrom)(channel, this.client);
116
+ },
117
+ /**
118
+ * Creates a new channel in the guild.
119
+ * @param guildId The ID of the guild.
120
+ * @param body The data for creating the channel.
121
+ * @returns A Promise that resolves to the created channel.
122
+ */
123
+ create: async (guildId, body) => {
124
+ const res = await this.client.proxy.guilds(guildId).channels.post({ body });
125
+ await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildId), res.id, guildId, res);
126
+ return (0, structures_1.channelFrom)(res, this.client);
127
+ },
128
+ /**
129
+ * Deletes a channel from the guild.
130
+ * @param guildId The ID of the guild.
131
+ * @param channelId The ID of the channel to delete.
132
+ * @param reason The reason for deleting the channel.
133
+ * @returns A Promise that resolves to the deleted channel.
134
+ */
135
+ delete: async (guildId, channelId, reason) => {
136
+ const res = await this.client.proxy.channels(channelId).delete({ reason });
137
+ await this.client.cache.channels?.removeIfNI(structures_1.BaseChannel.__intent__(guildId), res.id, guildId);
138
+ return (0, structures_1.channelFrom)(res, this.client);
139
+ },
140
+ /**
141
+ * Edits a channel in the guild.
142
+ * @param guildchannelId The ID of the guild.
143
+ * @param channelId The ID of the channel to edit.
144
+ * @param body The data to update the channel with.
145
+ * @param reason The reason for editing the channel.
146
+ * @returns A Promise that resolves to the edited channel.
147
+ */
148
+ edit: async (guildchannelId, channelId, body, reason) => {
149
+ const res = await this.client.proxy.channels(channelId).patch({ body, reason });
150
+ await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildchannelId), res.id, guildchannelId, res);
151
+ return (0, structures_1.channelFrom)(res, this.client);
152
+ },
153
+ /**
154
+ * Edits the positions of channels in the guild.
155
+ * @param guildId The ID of the guild.
156
+ * @param body The data containing the new positions of channels.
157
+ */
158
+ editPositions: (guildId, body) => this.client.proxy.guilds(guildId).channels.patch({ body }),
159
+ addFollower: async (channelId, webhook_channel_id, reason) => {
160
+ return this.client.proxy.channels(channelId).followers.post({
161
+ body: {
162
+ webhook_channel_id,
163
+ },
164
+ reason,
165
+ });
166
+ },
167
+ };
170
168
  /**
171
169
  * Provides access to auto-moderation rule-related functionality in a guild.
172
170
  */
173
- get moderation() {
174
- return {
175
- /**
176
- * Retrieves a list of auto-moderation rules in the guild.
177
- * @param guildId The ID of the guild.
178
- * @returns A Promise that resolves to an array of auto-moderation rules.
179
- */
180
- list: (guildId) => this.client.proxy
181
- .guilds(guildId)['auto-moderation'].rules.get()
182
- .then(rules => rules.map(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule))),
183
- /**
184
- * Creates a new auto-moderation rule in the guild.
185
- * @param guildId The ID of the guild.
186
- * @param body The data for creating the auto-moderation rule.
187
- * @returns A Promise that resolves to the created auto-moderation rule.
188
- */
189
- create: (guildId, body) => this.client.proxy
190
- .guilds(guildId)['auto-moderation'].rules.post({ body })
191
- .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule)),
192
- /**
193
- * Deletes an auto-moderation rule from the guild.
194
- * @param guildId The ID of the guild.
195
- * @param ruleId The ID of the rule to delete.
196
- * @param reason The reason for deleting the rule.
197
- * @returns A Promise that resolves once the rule is deleted.
198
- */
199
- delete: (guildId, ruleId, reason) => {
200
- return this.client.proxy.guilds(guildId)['auto-moderation'].rules(ruleId).delete({ reason });
201
- },
202
- /**
203
- * Fetches an auto-moderation rule by its ID.
204
- * @param guildId The ID of the guild.
205
- * @param ruleId The ID of the rule to fetch.
206
- * @returns A Promise that resolves to the fetched auto-moderation rule.
207
- */
208
- fetch: (guildId, ruleId) => {
209
- return this.client.proxy
210
- .guilds(guildId)['auto-moderation'].rules(ruleId)
211
- .get()
212
- .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule));
213
- },
214
- /**
215
- * Edits an auto-moderation rule in the guild.
216
- * @param guildId The ID of the guild.
217
- * @param ruleId The ID of the rule to edit.
218
- * @param body The data to update the rule with.
219
- * @param reason The reason for editing the rule.
220
- * @returns A Promise that resolves to the edited auto-moderation rule.
221
- */
222
- edit: (guildId, ruleId, body, reason) => {
223
- return this.client.proxy
224
- .guilds(guildId)['auto-moderation'].rules(ruleId)
225
- .patch({ body, reason })
226
- .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule));
227
- },
228
- };
229
- }
171
+ moderation = {
172
+ /**
173
+ * Retrieves a list of auto-moderation rules in the guild.
174
+ * @param guildId The ID of the guild.
175
+ * @returns A Promise that resolves to an array of auto-moderation rules.
176
+ */
177
+ list: (guildId) => this.client.proxy
178
+ .guilds(guildId)['auto-moderation'].rules.get()
179
+ .then(rules => rules.map(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule))),
180
+ /**
181
+ * Creates a new auto-moderation rule in the guild.
182
+ * @param guildId The ID of the guild.
183
+ * @param body The data for creating the auto-moderation rule.
184
+ * @returns A Promise that resolves to the created auto-moderation rule.
185
+ */
186
+ create: (guildId, body) => this.client.proxy
187
+ .guilds(guildId)['auto-moderation'].rules.post({ body })
188
+ .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule)),
189
+ /**
190
+ * Deletes an auto-moderation rule from the guild.
191
+ * @param guildId The ID of the guild.
192
+ * @param ruleId The ID of the rule to delete.
193
+ * @param reason The reason for deleting the rule.
194
+ * @returns A Promise that resolves once the rule is deleted.
195
+ */
196
+ delete: (guildId, ruleId, reason) => {
197
+ return this.client.proxy.guilds(guildId)['auto-moderation'].rules(ruleId).delete({ reason });
198
+ },
199
+ /**
200
+ * Fetches an auto-moderation rule by its ID.
201
+ * @param guildId The ID of the guild.
202
+ * @param ruleId The ID of the rule to fetch.
203
+ * @returns A Promise that resolves to the fetched auto-moderation rule.
204
+ */
205
+ fetch: (guildId, ruleId) => {
206
+ return this.client.proxy
207
+ .guilds(guildId)['auto-moderation'].rules(ruleId)
208
+ .get()
209
+ .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule));
210
+ },
211
+ /**
212
+ * Edits an auto-moderation rule in the guild.
213
+ * @param guildId The ID of the guild.
214
+ * @param ruleId The ID of the rule to edit.
215
+ * @param body The data to update the rule with.
216
+ * @param reason The reason for editing the rule.
217
+ * @returns A Promise that resolves to the edited auto-moderation rule.
218
+ */
219
+ edit: (guildId, ruleId, body, reason) => {
220
+ return this.client.proxy
221
+ .guilds(guildId)['auto-moderation'].rules(ruleId)
222
+ .patch({ body, reason })
223
+ .then(rule => transformers_1.Transformers.AutoModerationRule(this.client, rule));
224
+ },
225
+ };
230
226
  /**
231
227
  * Provides access to sticker-related functionality in a guild.
232
228
  */
233
- get stickers() {
234
- return {
235
- /**
236
- * Retrieves a list of stickers in the guild.
237
- * @param guildId The ID of the guild.
238
- * @returns A Promise that resolves to an array of stickers.
239
- */
240
- list: async (guildId) => {
241
- const stickers = await this.client.proxy.guilds(guildId).stickers.get();
242
- await this.client.cache.stickers?.set(cache_1.CacheFrom.Rest, stickers.map(st => [st.id, st]), guildId);
243
- return stickers.map(st => transformers_1.Transformers.Sticker(this.client, st));
244
- },
245
- /**
246
- * Creates a new sticker in the guild.
247
- * @param guildId The ID of the guild.
248
- * @param request The request body for creating the sticker.
249
- * @param reason The reason for creating the sticker.
250
- * @returns A Promise that resolves to the created sticker.
251
- */
252
- create: async (guildId, { file, ...json }, reason) => {
253
- const fileResolve = await (0, builders_1.resolveFiles)([file]);
254
- const sticker = await this.client.proxy
255
- .guilds(guildId)
256
- .stickers.post({ reason, body: json, files: [{ ...fileResolve[0], key: 'file' }], appendToFormData: true });
257
- await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', sticker.id, guildId, sticker);
258
- return transformers_1.Transformers.Sticker(this.client, sticker);
259
- },
260
- /**
261
- * Edits an existing sticker in the guild.
262
- * @param guildId The ID of the guild.
263
- * @param stickerId The ID of the sticker to edit.
264
- * @param body The data to update the sticker with.
265
- * @param reason The reason for editing the sticker.
266
- * @returns A Promise that resolves to the edited sticker.
267
- */
268
- edit: async (guildId, stickerId, body, reason) => {
269
- const sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).patch({ body, reason });
270
- await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', stickerId, guildId, sticker);
271
- return transformers_1.Transformers.Sticker(this.client, sticker);
272
- },
273
- /**
274
- * Fetches a sticker by its ID from the guild.
275
- * @param guildId The ID of the guild.
276
- * @param stickerId The ID of the sticker to fetch.
277
- * @param force Whether to force fetching the sticker from the API even if it exists in the cache.
278
- * @returns A Promise that resolves to the fetched sticker.
279
- */
280
- fetch: async (guildId, stickerId, force = false) => {
281
- let sticker;
282
- if (!force) {
283
- sticker = await this.client.cache.stickers?.get(stickerId);
284
- if (sticker)
285
- return sticker;
286
- }
287
- sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).get();
288
- await this.client.cache.stickers?.patch(cache_1.CacheFrom.Rest, stickerId, guildId, sticker);
289
- return transformers_1.Transformers.Sticker(this.client, sticker);
290
- },
291
- /**
292
- * Deletes a sticker from the guild.
293
- * @param guildId The ID of the guild.
294
- * @param stickerId The ID of the sticker to delete.
295
- * @param reason The reason for deleting the sticker.
296
- * @returns A Promise that resolves once the sticker is deleted.
297
- */
298
- delete: async (guildId, stickerId, reason) => {
299
- await this.client.proxy.guilds(guildId).stickers(stickerId).delete({ reason });
300
- await this.client.cache.stickers?.removeIfNI('GuildExpressions', stickerId, guildId);
301
- },
302
- };
303
- }
229
+ stickers = {
230
+ /**
231
+ * Retrieves a list of stickers in the guild.
232
+ * @param guildId The ID of the guild.
233
+ * @returns A Promise that resolves to an array of stickers.
234
+ */
235
+ list: async (guildId) => {
236
+ const stickers = await this.client.proxy.guilds(guildId).stickers.get();
237
+ await this.client.cache.stickers?.set(cache_1.CacheFrom.Rest, stickers.map(st => [st.id, st]), guildId);
238
+ return stickers.map(st => transformers_1.Transformers.Sticker(this.client, st));
239
+ },
240
+ /**
241
+ * Creates a new sticker in the guild.
242
+ * @param guildId The ID of the guild.
243
+ * @param request The request body for creating the sticker.
244
+ * @param reason The reason for creating the sticker.
245
+ * @returns A Promise that resolves to the created sticker.
246
+ */
247
+ create: async (guildId, { file, ...json }, reason) => {
248
+ const fileResolve = await (0, builders_1.resolveFiles)([file]);
249
+ const sticker = await this.client.proxy
250
+ .guilds(guildId)
251
+ .stickers.post({ reason, body: json, files: [{ ...fileResolve[0], key: 'file' }], appendToFormData: true });
252
+ await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', sticker.id, guildId, sticker);
253
+ return transformers_1.Transformers.Sticker(this.client, sticker);
254
+ },
255
+ /**
256
+ * Edits an existing sticker in the guild.
257
+ * @param guildId The ID of the guild.
258
+ * @param stickerId The ID of the sticker to edit.
259
+ * @param body The data to update the sticker with.
260
+ * @param reason The reason for editing the sticker.
261
+ * @returns A Promise that resolves to the edited sticker.
262
+ */
263
+ edit: async (guildId, stickerId, body, reason) => {
264
+ const sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).patch({ body, reason });
265
+ await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', stickerId, guildId, sticker);
266
+ return transformers_1.Transformers.Sticker(this.client, sticker);
267
+ },
268
+ /**
269
+ * Fetches a sticker by its ID from the guild.
270
+ * @param guildId The ID of the guild.
271
+ * @param stickerId The ID of the sticker to fetch.
272
+ * @param force Whether to force fetching the sticker from the API even if it exists in the cache.
273
+ * @returns A Promise that resolves to the fetched sticker.
274
+ */
275
+ fetch: async (guildId, stickerId, force = false) => {
276
+ let sticker;
277
+ if (!force) {
278
+ sticker = await this.client.cache.stickers?.get(stickerId);
279
+ if (sticker)
280
+ return sticker;
281
+ }
282
+ sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).get();
283
+ await this.client.cache.stickers?.patch(cache_1.CacheFrom.Rest, stickerId, guildId, sticker);
284
+ return transformers_1.Transformers.Sticker(this.client, sticker);
285
+ },
286
+ /**
287
+ * Deletes a sticker from the guild.
288
+ * @param guildId The ID of the guild.
289
+ * @param stickerId The ID of the sticker to delete.
290
+ * @param reason The reason for deleting the sticker.
291
+ * @returns A Promise that resolves once the sticker is deleted.
292
+ */
293
+ delete: async (guildId, stickerId, reason) => {
294
+ await this.client.proxy.guilds(guildId).stickers(stickerId).delete({ reason });
295
+ await this.client.cache.stickers?.removeIfNI('GuildExpressions', stickerId, guildId);
296
+ },
297
+ };
304
298
  }
305
299
  exports.GuildShorter = GuildShorter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.2.1-dev-12726380923.0",
3
+ "version": "2.2.1-dev-12801030016.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",