mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix: remove casts when using makeURLSearchParams() (#8877)
This commit is contained in:
@@ -29,7 +29,7 @@ export class ApplicationCommandsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getGlobalCommands(applicationId: Snowflake, options: RESTGetAPIApplicationCommandsQuery = {}) {
|
public async getGlobalCommands(applicationId: Snowflake, options: RESTGetAPIApplicationCommandsQuery = {}) {
|
||||||
return this.rest.get(Routes.applicationCommands(applicationId), {
|
return this.rest.get(Routes.applicationCommands(applicationId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIApplicationCommandsResult>;
|
}) as Promise<RESTGetAPIApplicationCommandsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ export class ApplicationCommandsAPI {
|
|||||||
data: RESTGetAPIApplicationGuildCommandsQuery = {},
|
data: RESTGetAPIApplicationGuildCommandsQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
|
return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
|
||||||
query: makeURLSearchParams(data as Record<string, unknown>),
|
query: makeURLSearchParams(data),
|
||||||
}) as Promise<RESTGetAPIApplicationCommandsResult>;
|
}) as Promise<RESTGetAPIApplicationCommandsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export class ChannelsAPI {
|
|||||||
options: RESTGetAPIChannelMessageReactionUsersQuery = {},
|
options: RESTGetAPIChannelMessageReactionUsersQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), {
|
return this.rest.get(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIChannelMessageReactionUsersResult>;
|
}) as Promise<RESTGetAPIChannelMessageReactionUsersResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ export class ChannelsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getMessages(channelId: Snowflake, options: RESTGetAPIChannelMessagesQuery = {}) {
|
public async getMessages(channelId: Snowflake, options: RESTGetAPIChannelMessagesQuery = {}) {
|
||||||
return this.rest.get(Routes.channelMessages(channelId), {
|
return this.rest.get(Routes.channelMessages(channelId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIChannelMessagesResult>;
|
}) as Promise<RESTGetAPIChannelMessagesResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ export class ChannelsAPI {
|
|||||||
options: RESTGetAPIChannelThreadsArchivedQuery = {},
|
options: RESTGetAPIChannelThreadsArchivedQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.channelThreads(channelId, archivedStatus), {
|
return this.rest.get(Routes.channelThreads(channelId, archivedStatus), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ export class ChannelsAPI {
|
|||||||
options: RESTGetAPIChannelThreadsArchivedQuery = {},
|
options: RESTGetAPIChannelThreadsArchivedQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.channelJoinedArchivedThreads(channelId), {
|
return this.rest.get(Routes.channelJoinedArchivedThreads(channelId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ export class GuildsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersQuery = {}) {
|
public async getMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersQuery = {}) {
|
||||||
return this.rest.get(Routes.guildMembers(guildId), {
|
return this.rest.get(Routes.guildMembers(guildId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildMemberResult>;
|
}) as Promise<RESTGetAPIGuildMemberResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ export class GuildsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getPruneCount(guildId: Snowflake, options: RESTGetAPIGuildPruneCountQuery = {}) {
|
public async getPruneCount(guildId: Snowflake, options: RESTGetAPIGuildPruneCountQuery = {}) {
|
||||||
return this.rest.get(Routes.guildPrune(guildId), {
|
return this.rest.get(Routes.guildPrune(guildId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildPruneCountResult>;
|
}) as Promise<RESTGetAPIGuildPruneCountResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ export class GuildsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getScheduledEvents(guildId: Snowflake, options: RESTGetAPIGuildScheduledEventsQuery = {}) {
|
public async getScheduledEvents(guildId: Snowflake, options: RESTGetAPIGuildScheduledEventsQuery = {}) {
|
||||||
return this.rest.get(Routes.guildScheduledEvents(guildId), {
|
return this.rest.get(Routes.guildScheduledEvents(guildId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildScheduledEventsResult>;
|
}) as Promise<RESTGetAPIGuildScheduledEventsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +566,7 @@ export class GuildsAPI {
|
|||||||
options: RESTGetAPIGuildScheduledEventQuery = {},
|
options: RESTGetAPIGuildScheduledEventQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.guildScheduledEvent(guildId, eventId), {
|
return this.rest.get(Routes.guildScheduledEvent(guildId, eventId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildScheduledEventResult>;
|
}) as Promise<RESTGetAPIGuildScheduledEventResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ export class GuildsAPI {
|
|||||||
options: RESTGetAPIGuildScheduledEventUsersQuery = {},
|
options: RESTGetAPIGuildScheduledEventUsersQuery = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.get(Routes.guildScheduledEventUsers(guildId, eventId), {
|
return this.rest.get(Routes.guildScheduledEventUsers(guildId, eventId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildScheduledEventUsersResult>;
|
}) as Promise<RESTGetAPIGuildScheduledEventUsersResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,7 +740,7 @@ export class GuildsAPI {
|
|||||||
*/
|
*/
|
||||||
public async getAuditLogs(guildId: Snowflake, options: RESTGetAPIAuditLogQuery = {}) {
|
public async getAuditLogs(guildId: Snowflake, options: RESTGetAPIAuditLogQuery = {}) {
|
||||||
return this.rest.get(Routes.guildAuditLog(guildId), {
|
return this.rest.get(Routes.guildAuditLog(guildId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIAuditLogResult>;
|
}) as Promise<RESTGetAPIAuditLogResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -832,7 +832,7 @@ export class GuildsAPI {
|
|||||||
*/
|
*/
|
||||||
public async searchForMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersSearchQuery) {
|
public async searchForMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersSearchQuery) {
|
||||||
return this.rest.get(Routes.guildMembersSearch(guildId), {
|
return this.rest.get(Routes.guildMembersSearch(guildId), {
|
||||||
query: makeURLSearchParams(options as unknown as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIGuildMembersSearchResult>;
|
}) as Promise<RESTGetAPIGuildMembersSearchResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export class InvitesAPI {
|
|||||||
*/
|
*/
|
||||||
public async get(code: string, options: RESTGetAPIInviteQuery = {}) {
|
public async get(code: string, options: RESTGetAPIInviteQuery = {}) {
|
||||||
return this.rest.get(Routes.invite(code), {
|
return this.rest.get(Routes.invite(code), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPIInviteResult>;
|
}) as Promise<RESTGetAPIInviteResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class UsersAPI {
|
|||||||
*/
|
*/
|
||||||
public async getGuilds(options: RESTGetAPICurrentUserGuildsQuery = {}) {
|
public async getGuilds(options: RESTGetAPICurrentUserGuildsQuery = {}) {
|
||||||
return this.rest.get(Routes.userGuilds(), {
|
return this.rest.get(Routes.userGuilds(), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
}) as Promise<RESTGetAPICurrentUserGuildsResult>;
|
}) as Promise<RESTGetAPICurrentUserGuildsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export class WebhooksAPI {
|
|||||||
options: RESTPostAPIWebhookWithTokenSlackQuery = {},
|
options: RESTPostAPIWebhookWithTokenSlackQuery = {},
|
||||||
) {
|
) {
|
||||||
await this.rest.post(Routes.webhookPlatform(id, token, 'slack'), {
|
await this.rest.post(Routes.webhookPlatform(id, token, 'slack'), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
body,
|
body,
|
||||||
auth: false,
|
auth: false,
|
||||||
});
|
});
|
||||||
@@ -155,7 +155,7 @@ export class WebhooksAPI {
|
|||||||
options: RESTPostAPIWebhookWithTokenGitHubQuery = {},
|
options: RESTPostAPIWebhookWithTokenGitHubQuery = {},
|
||||||
) {
|
) {
|
||||||
await this.rest.post(Routes.webhookPlatform(id, token, 'github'), {
|
await this.rest.post(Routes.webhookPlatform(id, token, 'github'), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
body,
|
body,
|
||||||
auth: false,
|
auth: false,
|
||||||
});
|
});
|
||||||
@@ -171,7 +171,7 @@ export class WebhooksAPI {
|
|||||||
*/
|
*/
|
||||||
public async getMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) {
|
public async getMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) {
|
||||||
return this.rest.get(Routes.webhookMessage(id, token, messageId), {
|
return this.rest.get(Routes.webhookMessage(id, token, messageId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
auth: false,
|
auth: false,
|
||||||
}) as Promise<RESTGetAPIChannelMessageResult>;
|
}) as Promise<RESTGetAPIChannelMessageResult>;
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ export class WebhooksAPI {
|
|||||||
*/
|
*/
|
||||||
public async deleteMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) {
|
public async deleteMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) {
|
||||||
await this.rest.delete(Routes.webhookMessage(id, token, messageId), {
|
await this.rest.delete(Routes.webhookMessage(id, token, messageId), {
|
||||||
query: makeURLSearchParams(options as Record<string, unknown>),
|
query: makeURLSearchParams(options),
|
||||||
auth: false,
|
auth: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user