From b7896756cd05da1f4166a6cb8de1667d7ef2e5fc Mon Sep 17 00:00:00 2001 From: Catry Date: Thu, 22 Oct 2020 15:48:43 +0900 Subject: [PATCH] Fix typos Co-Authored-By: yky4589 <8479056+yky4589@users.noreply.github.com> Co-Authored-By: Choi Minseo Co-Authored-By: Aki --- src/consts/urlsAndVersions.ts | 2 +- src/models/rest.ts | 1 + src/types/endpoint.ts | 144 +++++++++++++++++----------------- src/types/snowflake.ts | 10 +-- 4 files changed, 78 insertions(+), 79 deletions(-) create mode 100644 src/models/rest.ts diff --git a/src/consts/urlsAndVersions.ts b/src/consts/urlsAndVersions.ts index 7e7ef2f..c142df9 100644 --- a/src/consts/urlsAndVersions.ts +++ b/src/consts/urlsAndVersions.ts @@ -1,4 +1,4 @@ -export const DISCORD_API_URL = 'https://discord.com/api' //여기 v8 들어가야하는거 아닌가... <- gateway.ts 참조바람 왜 거기 endpoint에서 import에서 에러나지 왜?? +export const DISCORD_API_URL = 'https://discord.com/api' export const DISCORD_GATEWAY_URL = 'wss://gateway.discord.com' diff --git a/src/models/rest.ts b/src/models/rest.ts new file mode 100644 index 0000000..0632b43 --- /dev/null +++ b/src/models/rest.ts @@ -0,0 +1 @@ +// rest api \ No newline at end of file diff --git a/src/types/endpoint.ts b/src/types/endpoint.ts index 0770084..019063b 100644 --- a/src/types/endpoint.ts +++ b/src/types/endpoint.ts @@ -3,180 +3,180 @@ import { DISCORD_API_URL, DISCORD_API_VERSION, - DISCORD_CDN_URL, -} from "../consts/urlsAndVersions"; + DISCORD_CDN_URL +} from "../consts/urlsAndVersions" //Guild Endpoints -const GUILDS = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds`; +const GUILDS = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds` const GUILD = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}` const GUILD_AUDIT_LOGS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/audit-logs`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/audit-logs` const GUILD_WIDGET = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/widget`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/widget` const GUILD_EMOJI = (guildID: string, emoji_id: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis/${emoji_id}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis/${emoji_id}` const GUILD_ROLE = (guildID: string, roleID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles/${roleID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles/${roleID}` const GUILD_ROLES = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles` const GUILD_INTEGRATION = (guildID: string, integrationID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations/${integrationID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations/${integrationID}` const GUILD_INTEGRATIONS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations` const GUILD_INTEGARTION_SYNC = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations?include_appilications=true`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations?include_appilications=true` const GUILD_BAN = (guildID: string, userID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans/${userID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans/${userID}` const GUILD_BANS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans` const GUILD_CHANNEL = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}` const GUILD_CHANNELS = (guildID: string, channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/channels`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/channels` const GUILD_MEMBER = (guildID: string, memberID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/${memberID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/${memberID}` const GUILD_MEMBERS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members` const GUILD_MEMBER_ROLE = (guildID: string, memberID: string, roleID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/${memberID}/roles/${roleID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/${memberID}/roles/${roleID}` const GUILD_INVITES = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/invites`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/invites` const GUILD_LEAVE = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds/${guildID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds/${guildID}` const GUILD_PRUNE = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/prune`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/prune` const GUILD_VANITY_URL = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/vanity-url`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/vanity-url` const GUILD_NICK = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/@me/nick`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/@me/nick` const GUILD_WIDGET_IMAGE = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/widget.png`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/widget.png` const GUILD_PREVIEW = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/preview`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/preview` //Channel Endpoints const CHANNEL = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}` const CHANNELS = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${channelID}/channels`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${channelID}/channels` const CHANNEL_MESSAGES = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages` const CHANNEL_MESSAGE = (channelID: string, messageID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}` const CHANNEL_CROSSPOST = (channelID: string, messageID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/crosspost`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/crosspost` const MESSAGE_REACTIONS = (channelID: string, messageID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions` const MESSAGE_REACTION = ( channelID: string, messageID: string, emoji: string, ) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emoji}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emoji}` const MESSAGE_REACTION_ME = ( channelID: string, messageID: string, emojiID: string, ) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emojiID}/@me`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emojiID}/@me` const MESSAGE_REACTION_USER = ( channelID: string, messageID: string, emojiID: string, userID: string, ) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emojiID}/${userID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emojiID}/${userID}` const CHANNEL_BULK_DELETE = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/bulk-delete`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/bulk-delete` const CHANNEL_FOLLOW = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/followers`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/followers` const CHANNEL_INVITES = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/invites`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/invites` const CHANNEL_PIN = (channelID: string, messageID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/pins/${messageID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/pins/${messageID}` const CHANNEL_PINS = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/pins`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/pins` const CHANNEL_PERMISSION = (channelID: string, overrideID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/permissions/${overrideID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/permissions/${overrideID}` const CHANNEL_TYPING = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/typing`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/typing` const GROUP_RECIPIENT = (channelID: string, userID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/recipient/${userID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/recipient/${userID}` //User Endpoints -const CURRENT_USER = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me`; +const CURRENT_USER = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me` const CURRENT_USER_GUILDS = - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds`; -const USER_DM = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/channels`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds` +const USER_DM = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/channels` const USER_CONNECTIONS = - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/connections`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/connections` const LEAVE_GUILD = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds/${guildID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/guilds/${guildID}` const USER = (userID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/${userID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/${userID}` //Webhook Endpoints const CHANNEL_WEBHOOKS = (channelID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/webhooks`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/webhooks` const GUILD_WEBHOOK = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/webhooks`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/webhooks` const WEBHOOK = (webhookID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}` const WEBHOOK_WITH_TOKEN = (webhookID: string, webhookTOKEN: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}` const SLACK_WEBHOOK = (webhookID: string, webhookTOKEN: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}/slack`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}/slack` const GITHUB_WEBHOOK = (webhookID: string, webhookTOKEN: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}/github`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/webhooks/${webhookID}/${webhookTOKEN}/github` //Gateway Endpoints -const GATEWAY = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/gateway`; -const GATEWAY_BOT = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/gateway/bot`; +const GATEWAY = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/gateway` +const GATEWAY_BOT = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/gateway/bot` //CDN Endpoints const CUSTOM_EMOJI = (emojiID: string) => - `${DISCORD_CDN_URL}/emojis/${emojiID}.png`; + `${DISCORD_CDN_URL}/emojis/${emojiID}.png` const GUILD_ICON = (guildID: string, iconID: number) => - `${DISCORD_CDN_URL}/icons/${guildID}/${iconID}.png`; + `${DISCORD_CDN_URL}/icons/${guildID}/${iconID}.png` const GUILD_SPLASH = (guildID: string, guildSPLASH: string) => - `${DISCORD_CDN_URL}/splashes/${guildID}/${guildSPLASH}.png`; + `${DISCORD_CDN_URL}/splashes/${guildID}/${guildSPLASH}.png` const GUILD_DISCOVERY_SPLASH = ( guildID: string, guildDiscoverySplash: string, ) => - `${DISCORD_CDN_URL}/discovery-splashes/${guildID}/${guildDiscoverySplash}.png `; + `${DISCORD_CDN_URL}/discovery-splashes/${guildID}/${guildDiscoverySplash}.png ` const GUILD_BANNER = (guildID: string, guildBANNER: string) => - `${DISCORD_CDN_URL}/banners/${guildID}/${guildBANNER}.png`; + `${DISCORD_CDN_URL}/banners/${guildID}/${guildBANNER}.png` const DEFAULT_USER_AVATAR = (iconID: string) => - `${DISCORD_CDN_URL}/embed/avatars/${iconID}.png`; + `${DISCORD_CDN_URL}/embed/avatars/${iconID}.png` const USER_AVATAR = (userID: string, iconID: string) => - `${DISCORD_CDN_URL}/avatars/${userID}/${iconID}.png`; + `${DISCORD_CDN_URL}/avatars/${userID}/${iconID}.png` const APPLICATION_ASSET = (applicationID: string, assetID: number) => - `${DISCORD_CDN_URL}/app-icons/${applicationID}/${assetID}.png`; + `${DISCORD_CDN_URL}/app-icons/${applicationID}/${assetID}.png` const ACHIEVEMENT_ICON = ( applicationID: string, achievementID: string, iconHASH: string, ) => - `${DISCORD_CDN_URL}/app-assets/${applicationID}/achievements/${achievementID}/icons/${iconHASH}.png`; + `${DISCORD_CDN_URL}/app-assets/${applicationID}/achievements/${achievementID}/icons/${iconHASH}.png` const TEAM_ICON = (teamID: string, iconID: string) => - `${DISCORD_CDN_URL}/team-icons/${teamID}/${iconID}.png`; + `${DISCORD_CDN_URL}/team-icons/${teamID}/${iconID}.png` //Emoji Endpoints const EMOJI = (guildID: string, emojiID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis/${emojiID}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis/${emojiID}` const EMOJIS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis` //Template Endpoint const TEMPLATE = (templateCODE: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/templates/${templateCODE}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/templates/${templateCODE}` //Invite Endpoint const INVITE = (inviteCODE: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/invites/${inviteCODE}`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/invites/${inviteCODE}` //Voice Endpoint const VOICE_REGIONS = (guildID: string) => - `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/regions`; + `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/regions` diff --git a/src/types/snowflake.ts b/src/types/snowflake.ts index 37f8b14..f8ae6f6 100644 --- a/src/types/snowflake.ts +++ b/src/types/snowflake.ts @@ -1,8 +1,7 @@ -// 와갈, 따꾸, 동한드 export class Snowflake { - id: string; + id: string constructor(id: string) { - this.id = id; + this.id = id } deconstruct() { @@ -12,8 +11,7 @@ export class Snowflake { workerId: (snowflake & BigInt(0x3E0000)) >> BigInt(17), processId: (snowflake & BigInt(0x1F000)) >> BigInt(12), increment: snowflake & BigInt(0xFFF), - }; - - return res; + } + return res } }