Skip to content

Commit

Permalink
make token expiry offset adjustable
Browse files Browse the repository at this point in the history
  • Loading branch information
ssMMiles committed Aug 16, 2024
1 parent 8c3c888 commit f7c6924
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/app/contexts/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import { InteractionResponseAlreadySent, InteractionStateExpired } from "../../u
import { DiscordApplication, ResponseCallback } from "../DiscordApplication.js";
import { WebhookClient } from "../WebhookClient.js";

// lasts 15 minutes, minus 5 second buffer to be safe
const InteractionTokenExpiryTime = 15 * 60 * 1000 - 5000;
// 15 minute token, minus 250ms to account for latency
const TokenExpiryOffset = isNaN(Number(process.env.TOKEN_EXPIRY_OFFSET))
? 250
: Number(process.env.TOKEN_EXPIRY_OFFSET);
const InteractionTokenExpiryTime = 15 * 60 * 1000 - TokenExpiryOffset;

export class BaseInteractionContext<
T extends APIInteraction = APIInteraction,
Expand Down

0 comments on commit f7c6924

Please sign in to comment.