fix: fix overflow from bit calculation (#489)

* fix: fix overflow from bit caculation

* fix: fix typing issue

Co-authored-by: Byungchul Kim <64084503+chul0721@users.noreply.github.com>
This commit is contained in:
Ryu Juheon 2022-08-26 09:32:05 +09:00 committed by GitHub
parent cf0bc9dc08
commit 79c31256ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ const Calculator:NextPage<CalculatorProps> = ({ query }) => {
description: '디스코드 봇 초대링크를 간편하게 생성하세요'
}} />
<h1 className='text-4xl font-bold mt-2 mb-4'> </h1>
<div className='text-2xl font-bold inline-flex items-center'>: {Object.keys(value).filter(el => value[el]).map(el => Number(el)).reduce((prev, curr) => prev | curr, 0)}
<div className='text-2xl font-bold inline-flex items-center'>: {String(Object.keys(value).filter(el => value[el]).map(el => Number(el)).reduce((prev, curr) => BigInt(prev) | BigInt(curr), BigInt(0)))}
<span className='ml-2 text-lg font-semibold'>= { Object.keys(value).filter(el => value[el]).map(el => `0x${Number(el).toString(16)}`).join(' | ') }</span>
</div>
<div className='grid gap-2 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 mt-2'>
@ -125,4 +125,4 @@ interface CalculatorProps {
query: ParsedUrlQuery
}
export default Calculator
export default Calculator

View File

@ -241,7 +241,7 @@ export const DiscordEnpoints = {
Token: BASE_URLs.api + '/oauth2/token',
Me: BASE_URLs.api + '/v9/users/@me',
Guilds: BASE_URLs.api + '/v9/users/@me/guilds',
InviteApplication: (id: string, perms: { [perm: string]: boolean }, scope: string, redirect?: string, guild_id?: string): string => `${BASE_URLs.api}/oauth2/authorize?client_id=${id ? id.split(' ')[0] : 'CLIENT_ID'}&permissions=${Object.keys(perms).filter(el => perms[el]).map(el => Number(el)).reduce((prev, curr) => prev | curr, 0)}&scope=${scope ? encodeURI(scope) : 'bot'}${redirect ? `&redirect_uri=${encodeURIComponent(redirect)}` : ''}${guild_id ? `&guild_id=${guild_id}` : ''}`,
InviteApplication: (id: string, perms: { [perm: string]: boolean }, scope: string, redirect?: string, guild_id?: string): string => `${BASE_URLs.api}/oauth2/authorize?client_id=${id ? id.split(' ')[0] : 'CLIENT_ID'}&permissions=${Object.keys(perms).filter(el => perms[el]).map(el => Number(el)).reduce((prev, curr) => BigInt(prev) | BigInt(curr), BigInt(0))}&scope=${scope ? encodeURI(scope) : 'bot'}${redirect ? `&redirect_uri=${encodeURIComponent(redirect)}` : ''}${guild_id ? `&guild_id=${guild_id}` : ''}`,
ServerInvite: (code: string): string => `${BASE_URLs.invite}/${code}`,
CDN: class CDN {
static root = BASE_URLs.cdn
@ -520,4 +520,4 @@ export const GuildPermissions = {
twofactor: true
}
]
}
}