button onClick
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import type { EmojiResolvable, MessageButtonStyle } from "discord.js"
|
||||
import type {
|
||||
ButtonInteraction,
|
||||
EmojiResolvable,
|
||||
MessageButtonStyle,
|
||||
} from "discord.js"
|
||||
import { nanoid } from "nanoid"
|
||||
import React from "react"
|
||||
|
||||
export type ButtonStyle = Exclude<Lowercase<MessageButtonStyle>, "link">
|
||||
@@ -7,13 +12,19 @@ export type ButtonProps = {
|
||||
style?: ButtonStyle
|
||||
emoji?: EmojiResolvable
|
||||
disabled?: boolean
|
||||
onClick: (interaction: ButtonInteraction) => void
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
export function Button(props: ButtonProps) {
|
||||
return (
|
||||
<reacord-element
|
||||
createNode={() => ({ ...props, type: "button", children: [] })}
|
||||
createNode={() => ({
|
||||
...props,
|
||||
type: "button",
|
||||
children: [],
|
||||
customId: nanoid(),
|
||||
})}
|
||||
>
|
||||
{props.children}
|
||||
</reacord-element>
|
||||
|
||||
Reference in New Issue
Block a user