Compare commits

..

4 Commits

Author SHA1 Message Date
skinmaker1345
7ca716e48f fix: do not send vanity log when no changes are made 2025-06-21 19:07:36 +09:00
skinmaker1345
54c89490a4 chore: specify enforcement description 2025-06-14 21:34:58 +09:00
skinmaker1345
c4e1d804f1 feat: add alert page 2025-06-14 21:34:18 +09:00
skinmaker1345
c16925f873 feat: add enforcements field 2025-06-14 21:18:29 +09:00
10 changed files with 5 additions and 40 deletions

View File

@ -39,10 +39,6 @@ const patchLimiter = rateLimit({
})
const Bots = RequestHandler()
.get(async (req: GetApiRequest, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const bot = await get.bot.load(req.query.id)
if (!bot) return ResponseWrapper(res, { code: 404, message: '존재하지 않는 봇입니다.' })
else {

View File

@ -4,11 +4,7 @@ import ResponseWrapper from '@utils/ResponseWrapper'
import { Bot, List } from '@types'
const NewList = RequestHandler().get(async (req, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const NewList = RequestHandler().get(async (_req, res) => {
const result = await get.list.new.load(1)
return ResponseWrapper<List<Bot>>(res, { code: 200, data: result })
})

View File

@ -6,10 +6,6 @@ import { Bot, List } from '@types'
import Yup from '@utils/Yup'
const VotesList = RequestHandler().get(async (req, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const page = await Yup.number()
.positive()
.integer()

View File

@ -8,10 +8,6 @@ import { SearchQuerySchema } from '@utils/Yup'
import { Bot, Server, List } from '@types'
const Search = RequestHandler().get(async (req: ApiRequest, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const validated = await SearchQuerySchema.validate({ q: req.query.q || req.query.query, page: 1 })
.then((el) => el)
.catch((e) => {

View File

@ -8,10 +8,6 @@ import { SearchQuerySchema } from '@utils/Yup'
import { Bot, List } from '@types'
const SearchBots = RequestHandler().get(async (req: ApiRequest, res: NextApiResponse) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const validated = await SearchQuerySchema.validate({
q: req.query.q || req.query.query,
page: req.query.page,

View File

@ -8,10 +8,6 @@ import { SearchQuerySchema } from '@utils/Yup'
import { Server, List } from '@types'
const SearchServers = RequestHandler().get(async (req: ApiRequest, res: NextApiResponse) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const validated = await SearchQuerySchema.validate({
q: req.query.q || req.query.query,
page: req.query.page,

View File

@ -36,10 +36,6 @@ const patchLimiter = rateLimit({
})
const Servers = RequestHandler()
.get(async (req: GetApiRequest, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
const server = await get.server.load(req.query.id)
if (!server) return ResponseWrapper(res, { code: 404, message: '존재하지 않는 서버 입니다.' })
else {

View File

@ -5,10 +5,7 @@ import ResponseWrapper from '@utils/ResponseWrapper'
import RequestHandler from '@utils/RequestHandler'
const Users = RequestHandler().get(async (req: ApiRequest, res) => {
const auth = req.headers.authorization
? await get.BotAuthorization(req.headers.authorization)
: await get.Authorization(req.cookies.token)
if (!auth) return ResponseWrapper(res, { code: 401 })
console.log(req.query)
const user = await get.user.load(req.query?.id)
if (!user) return ResponseWrapper(res, { code: 404, message: '존재하지 않는 유저 입니다.' })
else return ResponseWrapper(res, { code: 200, data: user })

View File

@ -5,8 +5,6 @@ import type { NextPageContext } from 'next'
export type Nullable<T> = T | null
export type ValueOf<T> = T[keyof T]
export interface Bot {
id: string
name: string
@ -34,7 +32,7 @@ export interface Bot {
owners: User[] | string[]
}
export type BotEnforcementKeys = ValueOf<typeof botEnforcements>
export type BotEnforcementKeys = 'JOIN_ENFORCED' | 'JOIN_PARTIALLY_ENFORCED'
export interface RawGuild {
id: string

View File

@ -121,11 +121,9 @@ export const botCategoryDescription = {
}
export const botEnforcements = {
'서버 참여가 필요한 기능이 있습니다': 'JOIN_PARTIALLY_ENFORCED',
'서버 참여가 강제되는 명령어가 있습니다': 'JOIN_PARTIALLY_ENFORCED',
'서버 참여 없이는 봇의 핵심 기능을 사용할 수 없습니다': 'JOIN_ENFORCED',
'유료 구매가 필요한 기능이 있습니다': 'LICENSE_PARTIALLY_ENFORCED',
'유료 구매 없이는 봇의 핵심 기능을 사용할 수 없습니다': 'LICENSE_ENFORCED',
} as const
}
export const botCategoryIcon = {
: 'fas fa-cogs',