fix(interactions): add async responses

This commit is contained in:
41666 2021-08-07 18:00:20 -04:00
parent 3601d435b2
commit 26bc74bcbc
11 changed files with 220 additions and 149 deletions

View file

@ -5,6 +5,7 @@ export const discordAPIBase = 'https://discordapp.com/api/v9';
export enum AuthType {
Bearer = 'Bearer',
Bot = 'Bot',
None = 'None',
}
export const discordFetch = async <T>(
@ -17,7 +18,11 @@ export const discordFetch = async <T>(
...(init || {}),
headers: {
...(init?.headers || {}),
authorization: `${AuthType[authType]} ${auth}`,
...(authType !== AuthType.None
? {
authorization: `${AuthType[authType]} ${auth}`,
}
: {}),
'user-agent': userAgent,
},
});