dfx 0.20.3 → 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/DiscordConfig/index.js +1 -1
- package/DiscordConfig/index.js.map +1 -1
- package/README.md +48 -0
- package/package.json +7 -3
package/DiscordConfig/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as tsplus_module_2 from "@fp-ts/data/Duration";
|
|
|
3
3
|
import * as tsplus_module_3 from "dfx";
|
|
4
4
|
import * as tsplus_module_4 from "@effect/io/Layer";
|
|
5
5
|
import * as tsplus_module_5 from "@effect/io/Effect";
|
|
6
|
-
const VERSION =
|
|
6
|
+
const VERSION = 10;
|
|
7
7
|
export const DiscordConfig = tsplus_module_1.Tag();
|
|
8
8
|
export const make = ({ token, rest, gateway }) => ({
|
|
9
9
|
token,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordConfig/index.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordConfig/index.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,OAAO,GAAG,EAAE,CAAA;AAmBlB,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAA,GAAG,EAAiB,CAAA;AAQjD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAY,EAAiB,EAAE,CAAC,CAAC;IAC1E,KAAK;IACL,IAAI,EAAE;QACJ,OAAO,EAAE,4BAA4B,OAAO,EAAE;QAC9C,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACf,eAAe,EAAE;YACf,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,wBAAiB,CAAC,CAAC;YAC3B,GAAG,CAAC,IAAI,EAAE,eAAe,IAAI,EAAE,CAAC;SACjC;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,gBAAA,OAAO,CAAC,cAAc,CAAC,MAAM;QACtC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAA,IAAI,CAAC,IAAI,EAAE,wBAAc,aAAa,CAAC,CAAC,CAAA;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAG,4BAAmB,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,IAAI,GAAG,4BAAmB,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;AACzE,MAAM,CAAC,MAAM,OAAO,GAAG,4BAAmB,aAAa,CAAC,CACtD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CACzB,CAAA"}
|
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
|
}
|