dfx 0.20.4 → 0.20.5
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 +48 -0
- package/package.json +7 -3
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# dfx
|
|
2
|
+
|
|
3
|
+
A Discord library built on top of @effect/io
|
|
4
|
+
|
|
5
|
+
- Supports both the gateway and webhooks
|
|
6
|
+
- Simple yet powerful abstractions to build Discord bots
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
import * as Effect from "@effect/io/Effect"
|
|
12
|
+
import { pipe } from "@fp-ts/data/Function"
|
|
13
|
+
import { Ix } from "dfx"
|
|
14
|
+
import { runIx, make } from "dfx/gateway"
|
|
15
|
+
|
|
16
|
+
// Create the dependencies layer
|
|
17
|
+
const Dependencies = make({
|
|
18
|
+
token: "xxx",
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// Create hello command that responds with "Hello!"
|
|
22
|
+
const hello = Ix.global(
|
|
23
|
+
{
|
|
24
|
+
name: "hello",
|
|
25
|
+
description: "A basic command",
|
|
26
|
+
},
|
|
27
|
+
Effect.succeed({
|
|
28
|
+
type: 4,
|
|
29
|
+
data: {
|
|
30
|
+
content: "Hello!",
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// Run it and handle errors
|
|
36
|
+
pipe(
|
|
37
|
+
Ix.builder.add(hello),
|
|
38
|
+
runIx(
|
|
39
|
+
Effect.catchAll((e) =>
|
|
40
|
+
Effect.sync(() => {
|
|
41
|
+
console.error("CAUGHT ERROR", e)
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
),
|
|
45
|
+
Effect.providerLayer(Dependencies),
|
|
46
|
+
Effect.unsafeRunPromise,
|
|
47
|
+
)
|
|
48
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
},
|
|
9
9
|
"description": "Effect-TS discord library",
|
|
10
10
|
"author": "Tim Smart <hello@timsmart.co>",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/tim-smart/dfx.git"
|
|
14
|
+
},
|
|
11
15
|
"license": "MIT",
|
|
12
16
|
"scripts": {
|
|
13
|
-
"prepublishOnly": "pnpm run clean && pnpm run build:tsc && cp package.json dist/",
|
|
17
|
+
"prepublishOnly": "pnpm run clean && pnpm run build:tsc && cp package.json README.md dist/",
|
|
14
18
|
"build:tsc": "tsc -p tsconfig.json",
|
|
15
19
|
"types": "discord-api-codegen ./discord-api-docs -l typescript -o 'imports=RestResponse|dfx/DiscordREST/types' 'endpointReturnType=RestResponse' > src/types.ts && prettier -w src/types.ts",
|
|
16
20
|
"clean": "rm -rf dist/ *.tsbuildinfo"
|
|
@@ -49,5 +53,5 @@
|
|
|
49
53
|
"@fp-ts/data": "^0.0.25"
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "3e828b3e5d97ed8c543783969468e0cda3a7270f"
|
|
53
57
|
}
|