mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix: only allow named options for role button style
Numbered options gave an error when used.
This commit is contained in:
parent
a627c7d859
commit
22bd0ec422
1 changed files with 10 additions and 9 deletions
|
@ -3,19 +3,20 @@ import { BasePluginType } from "knub";
|
||||||
import { tMessageContent, tNullable } from "../../utils";
|
import { tMessageContent, tNullable } from "../../utils";
|
||||||
import { GuildRoleButtons } from "../../data/GuildRoleButtons";
|
import { GuildRoleButtons } from "../../data/GuildRoleButtons";
|
||||||
|
|
||||||
enum ButtonStyles {
|
|
||||||
PRIMARY = 1,
|
|
||||||
SECONDARY = 2,
|
|
||||||
SUCCESS = 3,
|
|
||||||
DANGER = 4,
|
|
||||||
// LINK = 5, We do not want users to create link buttons, but it would be style 5
|
|
||||||
}
|
|
||||||
|
|
||||||
const RoleButtonOption = t.type({
|
const RoleButtonOption = t.type({
|
||||||
role_id: t.string,
|
role_id: t.string,
|
||||||
label: tNullable(t.string),
|
label: tNullable(t.string),
|
||||||
emoji: tNullable(t.string),
|
emoji: tNullable(t.string),
|
||||||
style: tNullable(t.keyof(ButtonStyles)), // https://discord.js.org/#/docs/discord.js/v13/typedef/MessageButtonStyle
|
// https://discord.js.org/#/docs/discord.js/v13/typedef/MessageButtonStyle
|
||||||
|
style: tNullable(
|
||||||
|
t.union([
|
||||||
|
t.literal("PRIMARY"),
|
||||||
|
t.literal("SECONDARY"),
|
||||||
|
t.literal("SUCCESS"),
|
||||||
|
t.literal("DANGER"),
|
||||||
|
// t.literal("LINK"), // Role buttons don't use link buttons, but adding this here so it's documented why it's not available
|
||||||
|
]),
|
||||||
|
),
|
||||||
start_new_row: tNullable(t.boolean),
|
start_new_row: tNullable(t.boolean),
|
||||||
});
|
});
|
||||||
export type TRoleButtonOption = t.TypeOf<typeof RoleButtonOption>;
|
export type TRoleButtonOption = t.TypeOf<typeof RoleButtonOption>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue