mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
feat: fetchMessages method
This commit is contained in:
parent
d603836bc1
commit
989efb172e
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
PermissionFlagsBits,
|
PermissionFlagsBits,
|
||||||
|
type RESTGetAPIChannelMessagesQuery,
|
||||||
type RESTPatchAPIChannelJSONBody,
|
type RESTPatchAPIChannelJSONBody,
|
||||||
type RESTPostAPIChannelThreadsJSONBody,
|
type RESTPostAPIChannelThreadsJSONBody,
|
||||||
type RESTPostAPIGuildForumThreadsJSONBody,
|
type RESTPostAPIGuildForumThreadsJSONBody,
|
||||||
@ -176,6 +177,12 @@ export class ChannelShorter extends BaseShorter {
|
|||||||
permissions.add(roleOverwrites?.allow.bits ?? 0n);
|
permissions.add(roleOverwrites?.allow.bits ?? 0n);
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchMessages(channelId: string, query?: RESTGetAPIChannelMessagesQuery) {
|
||||||
|
return this.client.proxy.channels(channelId).messages.get({
|
||||||
|
query,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ChannelShorterOptionalParams = Partial<{ guildId: string; reason: string }>;
|
export type ChannelShorterOptionalParams = Partial<{ guildId: string; reason: string }>;
|
||||||
|
@ -24,6 +24,7 @@ export class MessageShorter extends BaseShorter {
|
|||||||
return new Message(this.client, message);
|
return new Message(this.client, message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit(messageId: string, channelId: string, { files, ...body }: MessageUpdateBodyRequest) {
|
async edit(messageId: string, channelId: string, { files, ...body }: MessageUpdateBodyRequest) {
|
||||||
const parsedFiles = files ? await resolveFiles(files) : [];
|
const parsedFiles = files ? await resolveFiles(files) : [];
|
||||||
return this.client.proxy
|
return this.client.proxy
|
||||||
@ -45,6 +46,7 @@ export class MessageShorter extends BaseShorter {
|
|||||||
.crosspost.post({ reason })
|
.crosspost.post({ reason })
|
||||||
.then(m => new Message(this.client, m));
|
.then(m => new Message(this.client, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(messageId: string, channelId: string, reason?: string) {
|
delete(messageId: string, channelId: string, reason?: string) {
|
||||||
return this.client.proxy
|
return this.client.proxy
|
||||||
.channels(channelId)
|
.channels(channelId)
|
||||||
@ -54,6 +56,7 @@ export class MessageShorter extends BaseShorter {
|
|||||||
void this.client.components?.onMessageDelete(messageId);
|
void this.client.components?.onMessageDelete(messageId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(messageId: string, channelId: string) {
|
fetch(messageId: string, channelId: string) {
|
||||||
return this.client.proxy
|
return this.client.proxy
|
||||||
.channels(channelId)
|
.channels(channelId)
|
||||||
@ -61,11 +64,12 @@ export class MessageShorter extends BaseShorter {
|
|||||||
.get()
|
.get()
|
||||||
.then(x => new Message(this.client, x));
|
.then(x => new Message(this.client, x));
|
||||||
}
|
}
|
||||||
|
|
||||||
purge(messages: string[], channelId: string, reason?: string) {
|
purge(messages: string[], channelId: string, reason?: string) {
|
||||||
return this.client.proxy.channels(channelId).messages['bulk-delete'].post({ body: { messages }, reason });
|
return this.client.proxy.channels(channelId).messages['bulk-delete'].post({ body: { messages }, reason });
|
||||||
}
|
}
|
||||||
|
|
||||||
async thread(
|
thread(
|
||||||
channelId: string,
|
channelId: string,
|
||||||
messageId: string,
|
messageId: string,
|
||||||
options: RESTPostAPIChannelMessagesThreadsJSONBody & { reason?: string },
|
options: RESTPostAPIChannelMessagesThreadsJSONBody & { reason?: string },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user