core/utils/Regex.ts
Junseo Park b7ca0cfc03
Feat: 신뢰된 봇 특전 수정 기능 추가 (#673)
* feat: camofy urls

* chore: unify standards

* feat: api changes for trusted bot perks

* feat: trusted bot perks on edit page

* chore: unify

* fix: wtf

* feat: hide perks menu for non-trusted bots

* fix: camo should be proceed at server-side

* type: typing issue

* fix: conflict

* fix: editing page on vanity code

* fix: removed reserved page

* feat: reserved vanity

* fix: for not found

* fix: bypass reserved vanity for offical bot

* chore: apply prettier

* chore: add webhook log for vanity change

---------

Co-authored-by: skinmaker1345 <skinmaker1345@gmail.com>
2025-03-28 00:27:18 +09:00

24 lines
839 B
TypeScript

import urlRegex from 'url-regex-safe'
const reservedVanityConst = [
'koreanbots',
'koreanservers',
'koreanlist',
'kbots',
'kodl',
'discord',
]
export const ID = /^[0-9]{17,}$/
export const Vanity = /^[A-Za-z\d-]+$/
export const Prefix = /^[^\s]/
export const HTTPProtocol = /^https?:\/\/.*?/
export const Url = urlRegex({ strict: true })
export const Emoji =
'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])'
export const Heading = '<h\\d id="(.+?)">(.*?)<\\/h(\\d)>'
export const EmojiSyntax = ':(\\w+):'
export const ImageTag = /<img\s[^>]*?alt\s*=\s*['"]([^'"]*?)['"][^>]*?>/
export const markdownImage = /!\[([^\]]*)\]\((.*?)\s*("(?:.*[^"])")?\s*\)/g
export const reservedVanity = new RegExp(`^((?!${reservedVanityConst.join('|')}).)*$`, 'i') // 예약되지 않음을 확인