Skip to content

Commit e46dccb

Browse files
committed
fix(discord): clarify command deploy rate-limit logs
1 parent 7471c21 commit e46dccb

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

extensions/discord/src/monitor/provider.deploy.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,22 @@ function wrapDeployRestMethod(params: {
166166
: Buffer.byteLength(typeof body === "string" ? body : JSON.stringify(body), "utf8");
167167
if (params.shouldLogVerbose()) {
168168
params.runtime.log?.(
169-
`discord startup [${params.accountId}] deploy-rest:${params.method}:start ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path}${typeof commandCount === "number" ? ` commands=${commandCount}` : ""}${typeof bodyBytes === "number" ? ` bytes=${bodyBytes}` : ""}`,
169+
`discord startup [${params.accountId}] native-slash-command-deploy-rest:${params.method}:start ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path}${typeof commandCount === "number" ? ` commands=${commandCount}` : ""}${typeof bodyBytes === "number" ? ` bytes=${bodyBytes}` : ""}`,
170170
);
171171
}
172172
try {
173173
const result = await params.original[params.method](path, data, query);
174174
if (params.shouldLogVerbose()) {
175175
params.runtime.log?.(
176-
`discord startup [${params.accountId}] deploy-rest:${params.method}:done ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path} requestMs=${Date.now() - startedAt}`,
176+
`discord startup [${params.accountId}] native-slash-command-deploy-rest:${params.method}:done ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path} requestMs=${Date.now() - startedAt}`,
177177
);
178178
}
179179
return result;
180180
} catch (err) {
181181
attachDiscordDeployRequestBody(err, body);
182182
const details = formatDiscordDeployErrorDetails(err);
183183
params.runtime.error?.(
184-
`discord startup [${params.accountId}] deploy-rest:${params.method}:error ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path} requestMs=${Date.now() - startedAt} error=${formatErrorMessage(err)}${details}`,
184+
`discord startup [${params.accountId}] native-slash-command-deploy-rest:${params.method}:error ${Math.max(0, Date.now() - params.startupStartedAt)}ms path=${path} requestMs=${Date.now() - startedAt} error=${formatErrorMessage(err)}${details}`,
185185
);
186186
throw err;
187187
}
@@ -257,7 +257,7 @@ export async function deployDiscordCommands(params: {
257257
if (isDailyCreateLimit(err)) {
258258
params.runtime.log?.(
259259
warn(
260-
`discord: native command deploy skipped for ${accountId}; daily application command create limit reached. Existing slash commands stay active until Discord resets the quota.`,
260+
`discord: native slash command deploy skipped for ${accountId}; daily application command create limit reached. Existing slash commands stay active until Discord resets the quota. Message send/receive is unaffected.`,
261261
),
262262
);
263263
return;
@@ -269,7 +269,7 @@ export async function deployDiscordCommands(params: {
269269
if (retryAfterMs > maxRetryDelayMs) {
270270
params.runtime.log?.(
271271
warn(
272-
`discord: native command deploy skipped for ${accountId}; retry_after=${retryAfterMs}ms exceeds startup budget. Existing slash commands stay active.`,
272+
`discord: native slash command deploy skipped for ${accountId}; retry_after=${retryAfterMs}ms exceeds startup budget. Existing slash commands stay active. Message send/receive is unaffected.`,
273273
),
274274
);
275275
return;
@@ -285,7 +285,9 @@ export async function deployDiscordCommands(params: {
285285
} catch (err) {
286286
const details = formatDiscordDeployErrorDetails(err);
287287
params.runtime.log?.(
288-
warn(`discord: native command deploy warning: ${formatErrorMessage(err)}${details}`),
288+
warn(
289+
`discord: native slash command deploy warning (not message send): ${formatErrorMessage(err)}${details}`,
290+
),
289291
);
290292
} finally {
291293
restoreDeployRestLogging();
@@ -325,7 +327,9 @@ export function runDiscordCommandDeployInBackground(params: {
325327
})
326328
.catch((err: unknown) => {
327329
params.runtime.log?.(
328-
warn(`discord: native command deploy background warning: ${formatErrorMessage(err)}`),
330+
warn(
331+
`discord: native slash command deploy background warning (not message send): ${formatErrorMessage(err)}`,
332+
),
329333
);
330334
});
331335
}

extensions/discord/src/monitor/provider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ describe("monitorDiscordProvider", () => {
791791
.mocked(runtime.log)
792792
.mock.calls.some(
793793
(call) =>
794-
String(call[0]).includes("native command deploy warning:") &&
794+
String(call[0]).includes("native slash command deploy warning (not message send):") &&
795795
String(call[0]).includes("This operation was aborted"),
796796
),
797797
).toBe(true);

0 commit comments

Comments
 (0)