|  | @@ -1,7 +1,6 @@
 | 
	
		
			
				|  |  |  import { GuildMember } from "discord.js";
 | 
	
		
			
				|  |  |  import { getRepository, In } from "typeorm";
 | 
	
		
			
				|  |  |  import { KnownUser } from "@shared/db/entity/KnownUser";
 | 
	
		
			
				|  |  | -import { HTTPError } from "got/dist/source";
 | 
	
		
			
				|  |  |  import humanizeDuration from "humanize-duration";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const VALID_EXTENSIONS = new Set([
 | 
	
	
		
			
				|  | @@ -79,35 +78,6 @@ export function formatString(str: string, vars: Record<string, string>): string
 | 
	
		
			
				|  |  |      return Object.keys(vars).filter(s => Object.prototype.hasOwnProperty.call(vars, s)).reduce((s, cur) => s.replace(`{${cur}}`, vars[cur]), str);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -export async function tryDo<TResult>(promise: Promise<TResult>) : Promise<Option<{result: TResult}, {error: unknown}>> {
 | 
	
		
			
				|  |  | -    try {
 | 
	
		
			
				|  |  | -        return {ok: true, result: await promise};
 | 
	
		
			
				|  |  | -    } catch(err) {
 | 
	
		
			
				|  |  | -        return {ok: false, error: err};
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -export async function assertOk<T>(promise: Promise<T>): Promise<T> {
 | 
	
		
			
				|  |  | -    try {
 | 
	
		
			
				|  |  | -        return await promise;
 | 
	
		
			
				|  |  | -    } catch (err) {
 | 
	
		
			
				|  |  | -        if (hasStackTrace(err)) {
 | 
	
		
			
				|  |  | -            const trace: {stack?: string} = {};
 | 
	
		
			
				|  |  | -            Error.captureStackTrace(trace);
 | 
	
		
			
				|  |  | -            err.stack = `${err.stack}\nCaused by: ${trace.stack}`;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        throw err;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -export function isHttpError(err?: unknown): err is HTTPError {
 | 
	
		
			
				|  |  | -    return err && Object.prototype.hasOwnProperty.call(err, "response");
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -export function hasStackTrace(reason?: unknown): reason is {stack: unknown} {
 | 
	
		
			
				|  |  | -    return reason && Object.prototype.hasOwnProperty.call(reason, "stack");
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  export function parseArgs(str: string): string[] {
 | 
	
		
			
				|  |  |      const result: string[] = [];
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -173,8 +143,4 @@ export function parseDuration(s: string): number | undefined {
 | 
	
		
			
				|  |  |      if (buffer.length != 0)
 | 
	
		
			
				|  |  |          return undefined;
 | 
	
		
			
				|  |  |      return result;
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -export type Ok<T> = T & { ok: true };
 | 
	
		
			
				|  |  | -export type Error<T> = T & { ok: false };
 | 
	
		
			
				|  |  | -export type Option<T, U = unknown> = Ok<T> | Error<U>;
 | 
	
		
			
				|  |  | +}
 |