mini-interactions 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/package.json +21 -5
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# mini-interactions
|
|
2
|
+
|
|
3
|
+
A TypeScript-first toolkit for Discord HTTP interactions. `mini-interactions`
|
|
4
|
+
is the main facade package and includes the core interaction types, Discord REST
|
|
5
|
+
client, Components V2 builders, and Linked Roles client.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install mini-interactions
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Components
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
ActionRowBuilder,
|
|
18
|
+
ButtonBuilder,
|
|
19
|
+
ButtonStyle,
|
|
20
|
+
} from "mini-interactions";
|
|
21
|
+
|
|
22
|
+
const row = new ActionRowBuilder().addComponents(
|
|
23
|
+
new ButtonBuilder()
|
|
24
|
+
.setCustomId("confirm")
|
|
25
|
+
.setLabel("Confirm")
|
|
26
|
+
.setStyle(ButtonStyle.Success),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
console.log(row.toJSON());
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Builders cover Discord's current component surface: buttons, every select menu,
|
|
33
|
+
text inputs, labels, modals, checkboxes, radio groups, file uploads, sections,
|
|
34
|
+
containers, media galleries, files, thumbnails, separators, and text displays.
|
|
35
|
+
|
|
36
|
+
## Linked Roles
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import {
|
|
40
|
+
ApplicationRoleConnectionMetadataType,
|
|
41
|
+
LinkedRolesClient,
|
|
42
|
+
RoleConnectionMetadataBuilder,
|
|
43
|
+
} from "mini-interactions/linked-roles";
|
|
44
|
+
|
|
45
|
+
const linkedRoles = new LinkedRolesClient({
|
|
46
|
+
applicationId: process.env.DISCORD_APPLICATION_ID!,
|
|
47
|
+
botToken: process.env.DISCORD_TOKEN!,
|
|
48
|
+
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
|
|
49
|
+
redirectUri: "https://example.com/discord/callback",
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await linkedRoles.updateMetadataRecords([
|
|
53
|
+
new RoleConnectionMetadataBuilder()
|
|
54
|
+
.setType(ApplicationRoleConnectionMetadataType.BooleanEqual)
|
|
55
|
+
.setKey("verified")
|
|
56
|
+
.setName("Verified")
|
|
57
|
+
.setDescription("Whether the account is verified"),
|
|
58
|
+
]);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Platform adapters
|
|
62
|
+
|
|
63
|
+
Platform adapters and database support remain optional. Install the adapter you
|
|
64
|
+
use, then import it through the main facade:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install mini-interactions-cloudflare
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { createCloudflareHandler } from "mini-interactions/cloudflare";
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Available optional packages:
|
|
75
|
+
|
|
76
|
+
- `mini-interactions-cloudflare`
|
|
77
|
+
- `mini-interactions-vercel`
|
|
78
|
+
- `mini-interactions-database`
|
|
79
|
+
|
|
80
|
+
The feature packages can also be installed and imported independently.
|
package/package.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mini-interactions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A TypeScript-first Discord HTTP interactions toolkit for Node.js, Vercel, and Cloudflare Workers.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"discord",
|
|
7
|
+
"interactions",
|
|
8
|
+
"cloudflare-workers",
|
|
9
|
+
"vercel",
|
|
10
|
+
"linked-roles",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
4
14
|
"type": "module",
|
|
5
15
|
"sideEffects": false,
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
6
22
|
"files": [
|
|
7
23
|
"dist"
|
|
8
24
|
],
|
|
@@ -42,10 +58,10 @@
|
|
|
42
58
|
"./package.json": "./package.json"
|
|
43
59
|
},
|
|
44
60
|
"dependencies": {
|
|
45
|
-
"mini-interactions-builders": "0.1.0",
|
|
46
61
|
"mini-interactions-core": "0.1.0",
|
|
47
62
|
"mini-interactions-rest": "0.1.0",
|
|
48
|
-
"mini-interactions-linked-roles": "0.1.0"
|
|
63
|
+
"mini-interactions-linked-roles": "0.1.0",
|
|
64
|
+
"mini-interactions-builders": "0.1.0"
|
|
49
65
|
},
|
|
50
66
|
"peerDependencies": {
|
|
51
67
|
"mini-interactions-database": "^0.1.0",
|
|
@@ -65,8 +81,8 @@
|
|
|
65
81
|
},
|
|
66
82
|
"devDependencies": {
|
|
67
83
|
"mini-interactions-vercel": "0.1.0",
|
|
68
|
-
"mini-interactions-
|
|
69
|
-
"mini-interactions-
|
|
84
|
+
"mini-interactions-cloudflare": "0.1.0",
|
|
85
|
+
"mini-interactions-database": "0.1.0"
|
|
70
86
|
},
|
|
71
87
|
"scripts": {
|
|
72
88
|
"build": "tsup --config tsup.config.ts",
|