fix links, closes #17
This commit is contained in:
@@ -353,6 +353,17 @@ function getDiscordMessageOptions(reacordOptions: MessageOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
if (component.type === "link") {
|
||||
return {
|
||||
type: Discord.ComponentType.Button,
|
||||
url: component.url,
|
||||
label: component.label ?? "",
|
||||
style: Discord.ButtonStyle.Link,
|
||||
disabled: component.disabled,
|
||||
emoji: component.emoji,
|
||||
}
|
||||
}
|
||||
|
||||
if (component.type === "select") {
|
||||
return {
|
||||
...component,
|
||||
@@ -364,7 +375,7 @@ function getDiscordMessageOptions(reacordOptions: MessageOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
raise(`Unsupported component type: ${component.type}`)
|
||||
raise(`Unsupported component type: ${(component as any).type}`)
|
||||
},
|
||||
),
|
||||
})),
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as React from "react"
|
||||
import { useState } from "react"
|
||||
import {
|
||||
Button,
|
||||
Link,
|
||||
Option,
|
||||
ReacordDiscordJs,
|
||||
Select,
|
||||
@@ -132,3 +133,7 @@ await createTest("delete this", (channel) => {
|
||||
}
|
||||
reacord.send(channel.id, <DeleteThis />)
|
||||
})
|
||||
|
||||
await createTest("link", (channel) => {
|
||||
reacord.send(channel.id, <Link label="hi" url="https://mapleleaf.dev" />)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user