diff --git a/pages/developers/applications/bots/[id].tsx b/pages/developers/applications/bots/[id].tsx new file mode 100644 index 0000000..b84f252 --- /dev/null +++ b/pages/developers/applications/bots/[id].tsx @@ -0,0 +1,94 @@ +import { NextPage, NextPageContext } from 'next' +import dynamic from 'next/dynamic' +import { useState } from 'react' +import useCopyClipboard from 'react-use-clipboard' + +import { get } from '@utils/Query' +import { parseCookie } from '@utils/Tools' + +import { ParsedUrlQuery } from 'querystring' +import { Bot, BotSpec, User } from '@types' +import NotFound from 'pages/404' +import { Form, Formik } from 'formik' +import { DeveloperBotSchema } from '@utils/Yup' + +const Button = dynamic(() => import('@components/Button')) +const Divider = dynamic(() => import('@components/Divider')) +const Input = dynamic(() => import('@components/Form/Input')) +const Container = dynamic(() => import('@components/Container')) +const DeveloperLayout = dynamic(() => import('@components/DeveloperLayout')) +const SEO = dynamic(() => import('@components/SEO')) +const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar')) + +const BotApplication: NextPage = ({ user, spec, bot }) => { + const [ showToken, setShowToken ] = useState(false) + const [ tokenCopied, setTokenCopied ] = useCopyClipboard(spec?.token, { + successDuration: 1000 + }) + + if(!bot || !spec) return + return +

봇 설정

+

한국 디스코드봇 리스트 API를 사용해보세요.

+
+
+ +
+
+

{bot.name}

+
+

봇 토큰

+
{showToken ? spec.token : '*********'}
+
+ + + +
+ console.log(d)}> + {({ errors, touched }) => ( +
+
+

웹훅 URL

+

웹훅을 이용하여 다양한 한국 디스코드봇 리스트의 봇에 발생하는 이벤트를 받아볼 수 있습니다.

+ + {touched.webhook && errors.webhook ?
{errors.webhook}
: null} +
+ + + )} +
+
+
+
+
+ +} + +interface BotApplicationProps { + user: User + spec: BotSpec + bot: Bot +} + +export const getServerSideProps = async (ctx: Context) => { + const parsed = parseCookie(ctx.req) + const user = await get.Authorization(parsed?.token) || '' + + return { + props: { spec: await get.botSpec(ctx.query.id, user), bot: await get.bot.load(ctx.query.id) } + } +} + +interface Context extends NextPageContext { + query: URLQuery +} + +interface URLQuery extends ParsedUrlQuery { + id: string + date: string +} + +export default BotApplication \ No newline at end of file