mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
Merge pull request #1897 from Disq-Code-Bot/fix/secret-key-option
Fix/secret key option
This commit is contained in:
+2
-1
@@ -112,7 +112,7 @@ export function createBot(options: CreateBotOptions): Bot {
|
||||
unrepliedInteractions: new Set<bigint>(),
|
||||
fetchAllMembersProcessingRequests: new Map(),
|
||||
},
|
||||
rest: createRestManager({ token: options.token, debug: options.events.debug }),
|
||||
rest: createRestManager({ token: options.token, debug: options.events.debug, secretKey: options.secretKey ?? undefined }),
|
||||
} as Bot;
|
||||
|
||||
bot.helpers = createHelpers(bot, options.helpers ?? {});
|
||||
@@ -399,6 +399,7 @@ export interface CreateBotOptions {
|
||||
token: string;
|
||||
botId: bigint;
|
||||
applicationId?: bigint;
|
||||
secretKey?: string;
|
||||
events: Partial<EventHandlers>;
|
||||
intents: (keyof typeof GatewayIntents)[];
|
||||
botGatewayData?: GetGatewayBot;
|
||||
|
||||
@@ -35,6 +35,12 @@ export async function runMethod<T = any>(
|
||||
throw errorStack;
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
errorStack.message = result.statusText as Error['message'];
|
||||
console.error(`Error: ${errorStack.message}`);
|
||||
throw errorStack;
|
||||
}
|
||||
|
||||
return result.status !== 204 ? await result.json() : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user