From 972a91b8debb7e47822c4979719efd37b371d381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Sun, 24 Jan 2021 10:14:08 +0900 Subject: [PATCH] feat: added oauth URL generate method and buffter to stream --- utils/Tools.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/utils/Tools.ts b/utils/Tools.ts index b230431..23cb763 100644 --- a/utils/Tools.ts +++ b/utils/Tools.ts @@ -1,5 +1,6 @@ -import { ImageOptions, UserPemissionFlags } from '../types' -import { perms } from './Constants' +import { Readable } from 'stream' +import { ImageOptions, UserPemissionFlags } from '@types' +import { Oauth, perms } from './Constants' export function formatNumber(value: number):string { const suffixes = ['', '만', '억', '조','해'] @@ -49,4 +50,21 @@ export function checkBrowser(){ return M.join(' ') } +export function generateOauthURL(provider: 'discord', clientID: string, scope: string) { + return Oauth[provider](clientID, scope) +} + +export default function bufferToStream(binary: Buffer) { + + const readableInstanceStream = new Readable({ + read() { + this.push(binary) + this.push(null) + } + }) + + return readableInstanceStream +} + + export { anchorHeader } from './ShowdownExtensions' \ No newline at end of file