seyfert 2.1.1-dev-11871867614.0 → 2.1.1-dev-11874638750.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.
- package/lib/cache/resources/channels.d.ts +1 -0
- package/lib/cache/resources/channels.js +4 -0
- package/lib/common/shorters/messages.d.ts +2 -1
- package/lib/common/shorters/messages.js +13 -7
- package/lib/structures/channels.d.ts +4 -2
- package/lib/structures/channels.js +15 -15
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import type { ReturnCache } from '../index';
|
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Channels extends GuildRelatedResource<any, APIChannel> {
|
|
6
6
|
namespace: string;
|
|
7
|
+
filter(data: APIChannel, id: string, guild_id: string): boolean;
|
|
7
8
|
parse(data: APIChannel, id: string, guild_id: string): any;
|
|
8
9
|
get(id: string): ReturnCache<AllChannels | undefined>;
|
|
9
10
|
raw(id: string): ReturnCache<Omit<APIChannel, 'permission_overwrites'> | undefined>;
|
|
@@ -6,6 +6,10 @@ const structures_1 = require("../../structures");
|
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Channels extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'channel';
|
|
9
|
+
//@ts-expect-error
|
|
10
|
+
filter(data, id, guild_id) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
9
13
|
parse(data, id, guild_id) {
|
|
10
14
|
const { permission_overwrites, ...rest } = super.parse(data, id, guild_id);
|
|
11
15
|
return rest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RESTPostAPIChannelMessagesThreadsJSONBody } from '../../types';
|
|
1
|
+
import type { RESTGetAPIChannelMessagesQuery, RESTPostAPIChannelMessagesThreadsJSONBody } from '../../types';
|
|
2
2
|
import type { ValidAnswerId } from '../../api/Routes/channels';
|
|
3
3
|
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../types/write';
|
|
4
4
|
import { BaseShorter } from './base';
|
|
@@ -14,4 +14,5 @@ export declare class MessageShorter extends BaseShorter {
|
|
|
14
14
|
}): Promise<import("../../structures").ThreadChannel>;
|
|
15
15
|
endPoll(channelId: string, messageId: string): Promise<import("../../structures").Message>;
|
|
16
16
|
getAnswerVoters(channelId: string, messageId: string, answerId: ValidAnswerId): Promise<import("../../structures").User[]>;
|
|
17
|
+
list(channelId: string, fetchOptions: RESTGetAPIChannelMessagesQuery): Promise<import("../../structures").Message[]>;
|
|
17
18
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MessageShorter = void 0;
|
|
4
4
|
const builders_1 = require("../../builders");
|
|
5
5
|
const structures_1 = require("../../structures");
|
|
6
|
-
const
|
|
6
|
+
const client_1 = require("../../client");
|
|
7
7
|
const base_1 = require("./base");
|
|
8
8
|
class MessageShorter extends base_1.BaseShorter {
|
|
9
9
|
async write(channelId, { files, ...body }) {
|
|
@@ -17,7 +17,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
17
17
|
})
|
|
18
18
|
.then(async (message) => {
|
|
19
19
|
await this.client.cache.messages?.setIfNI('GuildMessages', message.id, message.channel_id, message);
|
|
20
|
-
return
|
|
20
|
+
return client_1.Transformers.Message(this.client, message);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
async edit(messageId, channelId, { files, ...body }) {
|
|
@@ -31,7 +31,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
31
31
|
})
|
|
32
32
|
.then(async (message) => {
|
|
33
33
|
await this.client.cache.messages?.setIfNI('GuildMessages', message.id, message.channel_id, message);
|
|
34
|
-
return
|
|
34
|
+
return client_1.Transformers.Message(this.client, message);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
crosspost(messageId, channelId, reason) {
|
|
@@ -41,7 +41,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
41
41
|
.crosspost.post({ reason })
|
|
42
42
|
.then(async (m) => {
|
|
43
43
|
await this.client.cache.messages?.setIfNI('GuildMessages', m.id, m.channel_id, m);
|
|
44
|
-
return
|
|
44
|
+
return client_1.Transformers.Message(this.client, m);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
delete(messageId, channelId, reason) {
|
|
@@ -61,7 +61,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
61
61
|
.get()
|
|
62
62
|
.then(async (x) => {
|
|
63
63
|
await this.client.cache.messages?.set(x.id, x.channel_id, x);
|
|
64
|
-
return
|
|
64
|
+
return client_1.Transformers.Message(this.client, x);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
purge(messages, channelId, reason) {
|
|
@@ -78,7 +78,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
78
78
|
.channels(channelId)
|
|
79
79
|
.polls(messageId)
|
|
80
80
|
.expire.post()
|
|
81
|
-
.then(message =>
|
|
81
|
+
.then(message => client_1.Transformers.Message(this.client, message));
|
|
82
82
|
}
|
|
83
83
|
getAnswerVoters(channelId, messageId, answerId) {
|
|
84
84
|
return this.client.proxy
|
|
@@ -86,7 +86,13 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
86
86
|
.polls(messageId)
|
|
87
87
|
.answers(answerId)
|
|
88
88
|
.get()
|
|
89
|
-
.then(data => data.users.map(user =>
|
|
89
|
+
.then(data => data.users.map(user => client_1.Transformers.User(this.client, user)));
|
|
90
|
+
}
|
|
91
|
+
list(channelId, fetchOptions) {
|
|
92
|
+
return this.client.proxy
|
|
93
|
+
.channels(channelId)
|
|
94
|
+
.messages.get({ query: fetchOptions })
|
|
95
|
+
.then(messages => messages.map(message => client_1.Transformers.Message(this.client, message)));
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
exports.MessageShorter = MessageShorter;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Collection, type RawFile } from '..';
|
|
2
|
-
import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DMChannelStructure, type DirectoryChannelStructure, type ForumChannelStructure, type MediaChannelStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type VoiceChannelStructure } from '../client
|
|
2
|
+
import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DMChannelStructure, type DirectoryChannelStructure, type ForumChannelStructure, type MediaChannelStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type VoiceChannelStructure } from '../client';
|
|
3
3
|
import type { UsingClient } from '../commands';
|
|
4
4
|
import type { EmojiResolvable, MessageCreateBodyRequest, MessageUpdateBodyRequest, MethodContext, ObjectToLower, StringToNumber, ToClass } from '../common';
|
|
5
|
-
import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type RESTPostAPIGuildForumThreadsJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
|
|
5
|
+
import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type RESTPostAPIGuildForumThreadsJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
|
|
6
6
|
import type { GuildMember } from './GuildMember';
|
|
7
7
|
import type { GuildRole } from './GuildRole';
|
|
8
8
|
import { DiscordBase } from './extra/DiscordBase';
|
|
@@ -120,6 +120,7 @@ export declare class MessagesMethods extends DiscordBase {
|
|
|
120
120
|
delete: (messageId: string, reason?: string) => Promise<void>;
|
|
121
121
|
fetch: (messageId: string) => Promise<import("./Message").Message>;
|
|
122
122
|
purge: (messages: string[], reason?: string) => Promise<void | undefined>;
|
|
123
|
+
list: (fetchOptions: RESTGetAPIChannelMessagesQuery) => Promise<import("./Message").Message[]>;
|
|
123
124
|
};
|
|
124
125
|
pins: {
|
|
125
126
|
fetch: () => Promise<import("./Message").Message[]>;
|
|
@@ -141,6 +142,7 @@ export declare class MessagesMethods extends DiscordBase {
|
|
|
141
142
|
delete: (messageId: string, reason?: string) => Promise<void>;
|
|
142
143
|
fetch: (messageId: string) => Promise<import("./Message").Message>;
|
|
143
144
|
purge: (messages: string[], reason?: string) => Promise<void | undefined>;
|
|
145
|
+
list: (fetchOptions: RESTGetAPIChannelMessagesQuery) => Promise<import("./Message").Message[]>;
|
|
144
146
|
};
|
|
145
147
|
static reactions(ctx: MethodContext<{
|
|
146
148
|
channelId: string;
|
|
@@ -10,7 +10,7 @@ exports.DirectoryChannel = exports.NewsChannel = exports.CategoryChannel = expor
|
|
|
10
10
|
exports.channelFrom = channelFrom;
|
|
11
11
|
const __1 = require("..");
|
|
12
12
|
const builders_1 = require("../builders");
|
|
13
|
-
const
|
|
13
|
+
const client_1 = require("../client");
|
|
14
14
|
const mixer_1 = require("../deps/mixer");
|
|
15
15
|
const types_1 = require("../types");
|
|
16
16
|
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
@@ -153,6 +153,7 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
|
153
153
|
delete: (messageId, reason) => ctx.client.messages.delete(messageId, ctx.channelId, reason),
|
|
154
154
|
fetch: (messageId) => ctx.client.messages.fetch(messageId, ctx.channelId),
|
|
155
155
|
purge: (messages, reason) => ctx.client.messages.purge(messages, ctx.channelId, reason),
|
|
156
|
+
list: (fetchOptions) => ctx.client.messages.list(ctx.channelId, fetchOptions),
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
159
|
static reactions(ctx) {
|
|
@@ -205,32 +206,32 @@ exports.TextBaseGuildChannel = TextBaseGuildChannel = __decorate([
|
|
|
205
206
|
function channelFrom(data, client) {
|
|
206
207
|
switch (data.type) {
|
|
207
208
|
case types_1.ChannelType.GuildStageVoice:
|
|
208
|
-
return
|
|
209
|
+
return client_1.Transformers.StageChannel(client, data);
|
|
209
210
|
case types_1.ChannelType.GuildMedia:
|
|
210
|
-
return
|
|
211
|
+
return client_1.Transformers.MediaChannel(client, data);
|
|
211
212
|
case types_1.ChannelType.DM:
|
|
212
|
-
return
|
|
213
|
+
return client_1.Transformers.DMChannel(client, data);
|
|
213
214
|
case types_1.ChannelType.GuildForum:
|
|
214
|
-
return
|
|
215
|
+
return client_1.Transformers.ForumChannel(client, data);
|
|
215
216
|
case types_1.ChannelType.AnnouncementThread:
|
|
216
217
|
case types_1.ChannelType.PrivateThread:
|
|
217
218
|
case types_1.ChannelType.PublicThread:
|
|
218
|
-
return
|
|
219
|
+
return client_1.Transformers.ThreadChannel(client, data);
|
|
219
220
|
case types_1.ChannelType.GuildDirectory:
|
|
220
|
-
return
|
|
221
|
+
return client_1.Transformers.DirectoryChannel(client, data);
|
|
221
222
|
case types_1.ChannelType.GuildVoice:
|
|
222
|
-
return
|
|
223
|
+
return client_1.Transformers.VoiceChannel(client, data);
|
|
223
224
|
case types_1.ChannelType.GuildText:
|
|
224
|
-
return
|
|
225
|
+
return client_1.Transformers.TextGuildChannel(client, data);
|
|
225
226
|
case types_1.ChannelType.GuildCategory:
|
|
226
|
-
return
|
|
227
|
+
return client_1.Transformers.CategoryChannel(client, data);
|
|
227
228
|
case types_1.ChannelType.GuildAnnouncement:
|
|
228
|
-
return
|
|
229
|
+
return client_1.Transformers.NewsChannel(client, data);
|
|
229
230
|
default: {
|
|
230
231
|
if ('guild_id' in data) {
|
|
231
|
-
return
|
|
232
|
+
return client_1.Transformers.BaseGuildChannel(client, data);
|
|
232
233
|
}
|
|
233
|
-
return
|
|
234
|
+
return client_1.Transformers.BaseChannel(client, data);
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
}
|
|
@@ -287,8 +288,7 @@ class VoiceChannelMethods extends DiscordBase_1.DiscordBase {
|
|
|
287
288
|
const states = await this.cache.voiceStates?.values(this.guildId);
|
|
288
289
|
if (!states?.length)
|
|
289
290
|
return [];
|
|
290
|
-
|
|
291
|
-
return filter;
|
|
291
|
+
return states.filter(state => state.channelId === this.id);
|
|
292
292
|
}
|
|
293
293
|
async members(force) {
|
|
294
294
|
const collection = new __1.Collection();
|