fix(api): various fixes for overlooked stuff (#9588)

* types(GuildsAPI): fix `getWidgetSettings()` result type

* types(GuildsAPI): fix `beginPrune()` result type

* types(GuildsAPI): fix `editAutoModerationRule()` result type

* types(ApplicationCommandsAPI): fix guild application types

* types(GuildsAPI): fix `createTemplate()` body type

* fix(InteractionsAPI): make `followUp()` return the message

According to the Discord docs, creating a followup message is the same as executing a webhook, but *wait is always true*, meaning we always get the message.

* types(WebhooksAPI): fix result types
This commit is contained in:
David Malchin
2023-05-22 10:59:57 +03:00
committed by GitHub
parent 985def3f25
commit 6c7a5ed1e7
4 changed files with 33 additions and 20 deletions

View File

@@ -47,8 +47,10 @@ import type {
RESTGetAPIGuildWelcomeScreenResult,
RESTGetAPIGuildWidgetImageResult,
RESTGetAPIGuildWidgetJSONResult,
RESTGetAPIGuildWidgetSettingsResult,
RESTGetAPITemplateResult,
RESTPatchAPIAutoModerationRuleJSONBody,
RESTPatchAPIAutoModerationRuleResult,
RESTPatchAPIGuildChannelPositionsJSONBody,
RESTPatchAPIGuildEmojiJSONBody,
RESTPatchAPIGuildEmojiResult,
@@ -78,6 +80,7 @@ import type {
RESTPostAPIGuildEmojiJSONBody,
RESTPostAPIGuildEmojiResult,
RESTPostAPIGuildPruneJSONBody,
RESTPostAPIGuildPruneResult,
RESTPostAPIGuildRoleJSONBody,
RESTPostAPIGuildRoleResult,
RESTPostAPIGuildScheduledEventJSONBody,
@@ -85,8 +88,8 @@ import type {
RESTPostAPIGuildsJSONBody,
RESTPostAPIGuildsMFAResult,
RESTPostAPIGuildsResult,
RESTPostAPIGuildTemplatesJSONBody,
RESTPostAPIGuildTemplatesResult,
RESTPostAPITemplateCreateGuildJSONBody,
RESTPutAPIGuildBanJSONBody,
RESTPutAPIGuildTemplateSyncResult,
Snowflake,
@@ -446,7 +449,7 @@ export class GuildsAPI {
body,
reason,
signal,
}) as Promise<RESTGetAPIGuildPruneCountResult>;
}) as Promise<RESTPostAPIGuildPruneResult>;
}
/**
@@ -506,7 +509,9 @@ export class GuildsAPI {
* @param options - The options for fetching the widget settings
*/
public async getWidgetSettings(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildWidgetSettings(guildId), { signal }) as Promise<RESTGetAPIGuildWidgetImageResult>;
return this.rest.get(Routes.guildWidgetSettings(guildId), {
signal,
}) as Promise<RESTGetAPIGuildWidgetSettingsResult>;
}
/**
@@ -1051,7 +1056,7 @@ export class GuildsAPI {
reason,
body,
signal,
}) as Promise<RESTPatchAPIAutoModerationRuleJSONBody>;
}) as Promise<RESTPatchAPIAutoModerationRuleResult>;
}
/**
@@ -1196,7 +1201,7 @@ export class GuildsAPI {
*/
public async createTemplate(
templateCode: string,
body: RESTPostAPITemplateCreateGuildJSONBody,
body: RESTPostAPIGuildTemplatesJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.post(Routes.template(templateCode), { body, signal }) as Promise<RESTPostAPIGuildTemplatesResult>;