This commit is contained in:
Skillz4Killz
2021-04-13 17:59:19 +00:00
committed by GitHub
parent c2f2afb211
commit 9446960bb0
8 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -11,12 +11,12 @@ export async function getChannelWebhooks(channelId: string) {
const result = (await rest.runMethod(
"get",
endpoints.CHANNEL_WEBHOOKS(channelId)
endpoints.CHANNEL_WEBHOOKS(channelId),
)) as DiscordWebhook[];
return new Collection(
result
.map((webhook) => snakeKeysToCamelCase<Webhook>(webhook))
.map((webhook) => [webhook.id, webhook])
.map((webhook) => [webhook.id, webhook]),
);
}
+5 -5
View File
@@ -12,7 +12,7 @@ import { endpoints } from "../../util/constants.ts";
export async function getChannels(guildId: string, addToCache = true) {
const result = (await rest.runMethod(
"get",
endpoints.GUILD_CHANNELS(guildId)
endpoints.GUILD_CHANNELS(guildId),
)) as DiscordChannel[];
return new Collection(
@@ -21,19 +21,19 @@ export async function getChannels(guildId: string, addToCache = true) {
result.map(async (res) => {
const discordenoChannel = await structures.createDiscordenoChannel(
res,
guildId
guildId,
);
if (addToCache) {
await cacheHandlers.set(
"channels",
discordenoChannel.id,
discordenoChannel
discordenoChannel,
);
}
return discordenoChannel;
})
}),
)
).map((c) => [c.id, c])
).map((c) => [c.id, c]),
);
}
+1 -1
View File
@@ -30,5 +30,5 @@ export async function getEmojis(guildId: string, addToCache = true) {
cacheHandlers.set("guilds", guildId, guild);
}
return new Collection(result.map(e => [e.id!, e]));
return new Collection(result.map((e) => [e.id!, e]));
}
+2 -2
View File
@@ -11,12 +11,12 @@ export async function getChannelInvites(channelId: string) {
const result = (await rest.runMethod(
"get",
endpoints.CHANNEL_INVITES(channelId)
endpoints.CHANNEL_INVITES(channelId),
)) as DiscordInvite[];
return new Collection(
result
.map((invite) => snakeKeysToCamelCase<Invite>(invite))
.map((invite) => [invite.code, invite])
.map((invite) => [invite.code, invite]),
);
}
+2 -2
View File
@@ -11,12 +11,12 @@ export async function getInvites(guildId: string) {
const result = (await rest.runMethod(
"get",
endpoints.GUILD_INVITES(guildId)
endpoints.GUILD_INVITES(guildId),
)) as DiscordInvite[];
return new Collection(
result
.map((invite) => snakeKeysToCamelCase<Invite>(invite))
.map((invite) => [invite.code, invite])
.map((invite) => [invite.code, invite]),
);
}
+2 -2
View File
@@ -14,12 +14,12 @@ export async function getRoles(guildId: string) {
const result = (await rest.runMethod(
"get",
endpoints.GUILD_ROLES(guildId)
endpoints.GUILD_ROLES(guildId),
)) as DiscordRole[];
return new Collection(
result
.map((role) => snakeKeysToCamelCase<Role>(role))
.map((role) => [role.id, role])
.map((role) => [role.id, role]),
);
}
+2 -2
View File
@@ -14,13 +14,13 @@ export async function getGuildTemplates(guildId: string) {
const templates = (await rest.runMethod(
"get",
endpoints.GUILD_TEMPLATES(guildId)
endpoints.GUILD_TEMPLATES(guildId),
)) as DiscordTemplate[];
return new Collection(
templates.map((template) => [
template.code,
structures.createTemplateStruct(template),
])
]),
);
}
+2 -2
View File
@@ -11,12 +11,12 @@ export async function getWebhooks(guildId: string) {
const result = (await rest.runMethod(
"get",
endpoints.GUILD_WEBHOOKS(guildId)
endpoints.GUILD_WEBHOOKS(guildId),
)) as DiscordWebhook[];
return new Collection(
result
.map((webhook) => snakeKeysToCamelCase<Webhook>(webhook))
.map((webhook) => [webhook.id, webhook])
.map((webhook) => [webhook.id, webhook]),
);
}