mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
feat(MessageMethods#list): implements /channels/{channel.id}/messages for getting bulk messages (#297)
* feat(Formatter#generateOAuth2URL): addition of a new method for creating discord oauth2 links * feat(MessageMethods#list): implements /channels/{channel.id}/messages for getting bulk messages
This commit is contained in:
parent
3e14166247
commit
d6a305a371
@ -1,13 +1,14 @@
|
||||
import { resolveFiles } from '../../builders';
|
||||
import { MessagesMethods } from '../../structures';
|
||||
import type {
|
||||
RESTGetAPIChannelMessagesQuery,
|
||||
RESTPatchAPIChannelMessageJSONBody,
|
||||
RESTPostAPIChannelMessageJSONBody,
|
||||
RESTPostAPIChannelMessagesThreadsJSONBody,
|
||||
} from '../../types';
|
||||
|
||||
import type { ValidAnswerId } from '../../api/Routes/channels';
|
||||
import { Transformers } from '../../client/transformers';
|
||||
import { Transformers } from '../../client';
|
||||
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../types/write';
|
||||
import { BaseShorter } from './base';
|
||||
|
||||
@ -111,4 +112,11 @@ export class MessageShorter extends BaseShorter {
|
||||
.get()
|
||||
.then(data => data.users.map(user => Transformers.User(this.client, user)));
|
||||
}
|
||||
|
||||
list(channelId: string, fetchOptions: RESTGetAPIChannelMessagesQuery) {
|
||||
return this.client.proxy
|
||||
.channels(channelId)
|
||||
.messages.get({ query: fetchOptions })
|
||||
.then(messages => messages.map(message => Transformers.Message(this.client, message)));
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
type ThreadChannelStructure,
|
||||
Transformers,
|
||||
type VoiceChannelStructure,
|
||||
} from '../client/transformers';
|
||||
} from '../client';
|
||||
import type { UsingClient } from '../commands';
|
||||
import type {
|
||||
EmojiResolvable,
|
||||
@ -45,6 +45,7 @@ import {
|
||||
ChannelType,
|
||||
type RESTAPIAttachment,
|
||||
type RESTGetAPIChannelMessageReactionUsersQuery,
|
||||
type RESTGetAPIChannelMessagesQuery,
|
||||
type RESTPatchAPIChannelJSONBody,
|
||||
type RESTPatchAPIGuildChannelPositionsJSONBody,
|
||||
type RESTPostAPIChannelWebhookJSONBody,
|
||||
@ -253,6 +254,7 @@ export class MessagesMethods extends DiscordBase {
|
||||
delete: (messageId: string, reason?: string) => ctx.client.messages.delete(messageId, ctx.channelId, reason),
|
||||
fetch: (messageId: string) => ctx.client.messages.fetch(messageId, ctx.channelId),
|
||||
purge: (messages: string[], reason?: string) => ctx.client.messages.purge(messages, ctx.channelId, reason),
|
||||
list: (fetchOptions: RESTGetAPIChannelMessagesQuery) => ctx.client.messages.list(ctx.channelId, fetchOptions),
|
||||
};
|
||||
}
|
||||
|
||||
@ -406,8 +408,7 @@ export class VoiceChannelMethods extends DiscordBase {
|
||||
if (!this.guildId) return [];
|
||||
const states = await this.cache.voiceStates?.values(this.guildId);
|
||||
if (!states?.length) return [];
|
||||
const filter = states.filter(state => state.channelId === this.id);
|
||||
return filter;
|
||||
return states.filter(state => state.channelId === this.id);
|
||||
}
|
||||
|
||||
public async members(force?: boolean) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user