mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:02:44 +00:00
fix(discord): land proxy/media/reaction/model-picker regressions
Reimplements core Discord fixes from #25277 #25523 #25575 #25588 #25731 with expanded tests. - thread proxy-aware fetch into inbound attachment/sticker downloads - fetch /gateway/bot via proxy dispatcher before ws connect - wire statusReactions emojis/timing overrides into controller - compact model-picker custom_id keys with backward-compatible parsing Co-authored-by: openperf <openperf@users.noreply.github.com> Co-authored-by: chilu18 <chilu18@users.noreply.github.com> Co-authored-by: Yipsh <Yipsh@users.noreply.github.com> Co-authored-by: lbo728 <lbo728@users.noreply.github.com> Co-authored-by: s1korrrr <s1korrrr@users.noreply.github.com>
This commit is contained in:
@@ -117,6 +117,28 @@ describe("Discord model picker custom_id", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("parses compact custom_id aliases", () => {
|
||||
const parsed = parseDiscordModelPickerData({
|
||||
c: "models",
|
||||
a: "submit",
|
||||
v: "models",
|
||||
u: "42",
|
||||
p: "openai",
|
||||
g: "3",
|
||||
mi: "2",
|
||||
});
|
||||
|
||||
expect(parsed).toEqual({
|
||||
command: "models",
|
||||
action: "submit",
|
||||
view: "models",
|
||||
userId: "42",
|
||||
provider: "openai",
|
||||
page: 3,
|
||||
modelIndex: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it("parses optional submit model index", () => {
|
||||
const parsed = parseDiscordModelPickerData({
|
||||
cmd: "models",
|
||||
@@ -179,6 +201,21 @@ describe("Discord model picker custom_id", () => {
|
||||
}),
|
||||
).toThrow(/custom_id exceeds/i);
|
||||
});
|
||||
|
||||
it("keeps typical submit ids under Discord max length", () => {
|
||||
const customId = buildDiscordModelPickerCustomId({
|
||||
command: "models",
|
||||
action: "submit",
|
||||
view: "models",
|
||||
provider: "azure-openai-responses",
|
||||
page: 1,
|
||||
providerPage: 1,
|
||||
modelIndex: 10,
|
||||
userId: "12345678901234567890",
|
||||
});
|
||||
|
||||
expect(customId.length).toBeLessThanOrEqual(DISCORD_CUSTOM_ID_MAX_CHARS);
|
||||
});
|
||||
});
|
||||
|
||||
describe("provider paging", () => {
|
||||
@@ -325,7 +362,7 @@ describe("Discord model picker rendering", () => {
|
||||
return parsed?.action === "provider";
|
||||
});
|
||||
expect(providerButtons).toHaveLength(Object.keys(entries).length);
|
||||
expect(allButtons.some((component) => (component.custom_id ?? "").includes(":act=nav:"))).toBe(
|
||||
expect(allButtons.some((component) => (component.custom_id ?? "").includes(";a=nav;"))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
@@ -352,7 +389,7 @@ describe("Discord model picker rendering", () => {
|
||||
expect(rows.length).toBeGreaterThan(0);
|
||||
|
||||
const allButtons = rows.flatMap((row) => row.components ?? []);
|
||||
expect(allButtons.some((component) => (component.custom_id ?? "").includes(":act=nav:"))).toBe(
|
||||
expect(allButtons.some((component) => (component.custom_id ?? "").includes(";a=nav;"))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user