-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.tsx
38 lines (33 loc) · 960 Bytes
/
mod.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { MessageComponentType, ButtonStyle } from 'https://deno.land/x/harmony@v2.0.0-rc2/mod.ts';
import React, { FunctionComponent } from "https://esm.sh/react";
interface Component {
type: MessageComponentType,
style: ButtonStyle,
label: String,
customID: String,
url?: String,
options?: { label: String, value: String }[]
}
interface Components {
type: MessageComponentType,
components: Component[]
}
export const Component: FunctionComponent<Component> = (props) => {
const { type, style, label, customID, url, options } = props;
return <> {{
type,
style,
label,
customID,
url,
options
}} </>
}
export const Components = (type: MessageComponentType, component: any[]): Components => {
let components: any = [];
component.forEach(r=> components.push(r.props))
return {
type,
components
}
}