Skip to content

Commit 7076be4

Browse files
fix: bypass reserved vanity for offical bot
1 parent f70ef52 commit 7076be4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

utils/Constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,3 +626,8 @@ export const GuildPermissions = {
626626
},
627627
],
628628
}
629+
630+
export const reservedVanityBypass = [
631+
'653534001742741552', '784618064167698472',
632+
'653083797763522580', '807561475014262785'
633+
]

utils/Yup.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Yup from 'yup'
22
import YupKorean from 'yup-locales-ko'
33
import { ListType } from '@types'
4-
import { botCategories, library, reportCats, serverCategories } from '@utils/Constants'
4+
import { botCategories, library, reportCats, reservedVanityBypass, serverCategories } from '@utils/Constants'
55
import { HTTPProtocol, ID, Prefix, reservedVanity, Url, Vanity } from '@utils/Regex'
66

77
Yup.setLocale(YupKorean)
@@ -297,10 +297,14 @@ export const ManageBotSchema: Yup.SchemaOf<ManageBot> = Yup.object({
297297
.max(1500, '봇 설명은 최대 1500자여야합니다.')
298298
.required('봇 설명은 필수 항목입니다.'),
299299
vanity: Yup.string()
300-
.min(3, '커스텀 URL은 최소 3자여야합니다.')
301-
.max(32, '커스텀 URL은 최대 32자여야합니다.')
302300
.matches(Vanity, '커스텀 URL은 영문만 포함할 수 있습니다.')
303-
.matches(reservedVanity, '사용할 수 없는 커스텀 URL입니다.')
301+
.when('id', {
302+
is: (id: string) => reservedVanityBypass.includes(id),
303+
then: Yup.string(),
304+
otherwise: Yup.string().matches(reservedVanity, '예약어가 포함되었거나 사용할 수 없는 커스텀 URL입니다.')
305+
})
306+
.min(2, '커스텀 URL은 최소 2자여야합니다.')
307+
.max(32, '커스텀 URL은 최대 32자여야합니다.')
304308
.nullable(),
305309
banner: Yup.string()
306310
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')

0 commit comments

Comments
 (0)