Fix typos

Co-Authored-By: yky4589 <8479056+yky4589@users.noreply.github.com>
Co-Authored-By: Choi Minseo <minseo0388@outlook.com>
Co-Authored-By: Aki <akiacode@users.noreply.github.com>
This commit is contained in:
Catry 2020-10-22 15:48:43 +09:00
parent 21b8954a7f
commit b7896756cd
4 changed files with 78 additions and 79 deletions

View file

@ -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'

1
src/models/rest.ts Normal file
View file

@ -0,0 +1 @@
// rest api

View file

@ -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`

View file

@ -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
}
}