use enums instead of strings for component type

This commit is contained in:
Crawron
2022-07-21 16:12:18 -05:00
committed by Darius
parent eb97b2d23d
commit 33bb2ee196

View File

@@ -342,12 +342,12 @@ function getDiscordMessageOptions(
content: reacordOptions.content || null, content: reacordOptions.content || null,
embeds: reacordOptions.embeds, embeds: reacordOptions.embeds,
components: reacordOptions.actionRows.map((row) => ({ components: reacordOptions.actionRows.map((row) => ({
type: "ACTION_ROW", type: Discord.ComponentType.ActionRow,
components: row.map( components: row.map(
(component): Discord.MessageActionRowComponentOptions => { (component): Discord.MessageActionRowComponentOptions => {
if (component.type === "button") { if (component.type === "button") {
return { return {
type: "BUTTON", type: Discord.ComponentType.Button,
customId: component.customId, customId: component.customId,
label: component.label ?? "", label: component.label ?? "",
style: convertButtonStyleToEnum(component.style), style: convertButtonStyleToEnum(component.style),
@@ -359,7 +359,7 @@ function getDiscordMessageOptions(
if (component.type === "select") { if (component.type === "select") {
return { return {
...component, ...component,
type: "SELECT_MENU", type: Discord.ComponentType.SelectMenu,
options: component.options.map((option) => ({ options: component.options.map((option) => ({
...option, ...option,
default: component.values?.includes(option.value), default: component.values?.includes(option.value),