mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
feat: support for Bearer auth type
This commit is contained in:
parent
06e6a013bd
commit
59b48b2168
@ -33,6 +33,7 @@ export class ApiHandler {
|
||||
this.options = {
|
||||
baseUrl: 'api/v10',
|
||||
domain: 'https://discord.com',
|
||||
type: 'Bot',
|
||||
...options,
|
||||
userAgent: DefaultUserAgent,
|
||||
};
|
||||
@ -329,7 +330,7 @@ export class ApiHandler {
|
||||
let finalUrl = options.url;
|
||||
let data: string | FormData | undefined;
|
||||
if (options.request.auth) {
|
||||
options.headers.Authorization = `Bot ${this.options.token}`;
|
||||
options.headers.Authorization = `${this.options.type} ${this.options.token}`;
|
||||
}
|
||||
if (options.request.query) {
|
||||
finalUrl += `?${new URLSearchParams(options.request.query)}`;
|
||||
|
@ -13,9 +13,10 @@ export interface ApiHandlerOptions {
|
||||
agent?: string;
|
||||
smartBucket?: boolean;
|
||||
workerProxy?: boolean;
|
||||
type?: 'Bearer' | 'Bot';
|
||||
}
|
||||
|
||||
export interface ApiHandlerInternalOptions extends MakeRequired<ApiHandlerOptions, 'baseUrl' | 'domain'> {
|
||||
export interface ApiHandlerInternalOptions extends MakeRequired<ApiHandlerOptions, 'baseUrl' | 'domain' | 'type'> {
|
||||
userAgent: string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user