feat: add query parameters options to fetchMessages function
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
This commit is contained in:
parent
417a558109
commit
febdbb9421
1 changed files with 2 additions and 3 deletions
|
@ -17,7 +17,6 @@ export const useApi = () => {
|
|||
return await fetchWithApi(`/channels/${channelId}`)
|
||||
}
|
||||
|
||||
|
||||
async function fetchMembers(guildId: string): Promise<GuildMemberResponse[] | undefined> {
|
||||
return await fetchWithApi(`/guilds/${guildId}/members`);
|
||||
}
|
||||
|
@ -34,8 +33,8 @@ export const useApi = () => {
|
|||
return await fetchWithApi(`/users/${userId}`);
|
||||
}
|
||||
|
||||
async function fetchMessages(channelId: string): Promise<MessageResponse[] | undefined> {
|
||||
return await fetchWithApi(`/channels/${channelId}/messages`);
|
||||
async function fetchMessages(channelId: string, options?: { amount?: number, offset?: number }): Promise<MessageResponse[] | undefined> {
|
||||
return await fetchWithApi(`/channels/${channelId}/messages`, { query: { amount: options?.amount ?? 100, offset: options?.offset ?? 0 } });
|
||||
}
|
||||
|
||||
async function fetchMessage(channelId: string, messageId: string): Promise<MessageResponse | undefined> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue