dfx 0.9.1 → 0.9.3
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/dist/DiscordGateway/DiscordWS/index.d.ts +2 -1
- package/dist/DiscordGateway/DiscordWS/index.d.ts.map +1 -1
- package/dist/DiscordGateway/DiscordWS/index.js +16 -15
- package/dist/DiscordGateway/DiscordWS/index.js.map +1 -1
- package/dist/DiscordGateway/Shard/heartbeats.d.ts +2 -1
- package/dist/DiscordGateway/Shard/heartbeats.d.ts.map +1 -1
- package/dist/DiscordGateway/Shard/heartbeats.js +12 -11
- package/dist/DiscordGateway/Shard/heartbeats.js.map +1 -1
- package/dist/DiscordGateway/Shard/index.d.ts +2 -1
- package/dist/DiscordGateway/Shard/index.d.ts.map +1 -1
- package/dist/DiscordGateway/Shard/index.js +18 -17
- package/dist/DiscordGateway/Shard/index.js.map +1 -1
- package/dist/DiscordGateway/Shard/invalidSession.d.ts +2 -1
- package/dist/DiscordGateway/Shard/invalidSession.d.ts.map +1 -1
- package/dist/DiscordGateway/Shard/invalidSession.js +5 -4
- package/dist/DiscordGateway/Shard/invalidSession.js.map +1 -1
- package/dist/DiscordGateway/Sharder/index.d.ts +1 -1
- package/dist/DiscordGateway/Sharder/index.js +9 -8
- package/dist/DiscordGateway/Sharder/index.js.map +1 -1
- package/dist/DiscordGateway/index.d.ts +2 -2
- package/dist/DiscordREST/index.d.ts +2 -2
- package/dist/Interactions/context.d.ts +1 -1
- package/dist/Interactions/definitions.d.ts +3 -3
- package/dist/Interactions/gateway.d.ts +2 -2
- package/dist/Interactions/gateway.d.ts.map +1 -1
- package/dist/Interactions/gateway.js +6 -5
- package/dist/Interactions/gateway.js.map +1 -1
- package/dist/Interactions/index.d.ts +3 -14
- package/dist/Interactions/index.d.ts.map +1 -1
- package/dist/Interactions/index.js +6 -16
- package/dist/Interactions/index.js.map +1 -1
- package/dist/Interactions/utils.d.ts.map +1 -1
- package/dist/Interactions/utils.js +7 -1
- package/dist/Interactions/utils.js.map +1 -1
- package/dist/Interactions/webhook.d.ts +10 -3
- package/dist/Interactions/webhook.d.ts.map +1 -1
- package/dist/Interactions/webhook.js +5 -1
- package/dist/Interactions/webhook.js.map +1 -1
- package/dist/RateLimitStore/index.d.ts +2 -2
- package/dist/common-gateway.d.ts +6 -0
- package/dist/common-gateway.d.ts.map +1 -0
- package/dist/common-gateway.js +6 -0
- package/dist/common-gateway.js.map +1 -0
- package/dist/common.d.ts +1 -6
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +1 -6
- package/dist/common.js.map +1 -1
- package/dist/global.d.ts +5 -1
- package/dist/global.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/webhooks.d.ts +16 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +23 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +4 -4
- package/src/Interactions/gateway.ts +4 -4
- package/src/Interactions/index.ts +2 -42
- package/src/Interactions/utils.ts +7 -1
- package/src/Interactions/webhook.ts +30 -1
- package/src/common-gateway.ts +5 -0
- package/src/common.ts +1 -6
- package/src/global.ts +5 -5
- package/src/index.ts +1 -12
- package/src/webhooks.ts +30 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="ws" />
|
|
3
|
-
import { Discord,
|
|
3
|
+
import { Discord, EffectSource } from "dfx/common";
|
|
4
|
+
import { WS } from "dfx/common-gateway";
|
|
4
5
|
import WebSocket from "isomorphic-ws";
|
|
5
6
|
export type Message = Discord.GatewayPayload | WS.Reconnect;
|
|
6
7
|
export interface OpenOpts {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,GAAG,EAAE,CAAC,SAAS,CAAA;AAE3D,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;IACpB,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,KAAK,MAAM,GAAG,MAAM,GAAG,WAAW,CAAA;IACpE,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,OAAO,KAAK,OAAO,CAAC,cAAc,CAAA;CACzD;AACD,eAAO,MAAM,cAAc,+CAAwB,CAAA;AACnD,eAAO,MAAM,sBAAsB,+DAIjC,CAAA;AAEF,eAAO,MAAM,IAAI,uBAGd,QAAQ;;;kBAIc,MAAM;EAoB3B,CAAA"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "dfx/common";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Layer";
|
|
3
|
-
import * as tsplus_module_3 from "
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
5
|
-
import * as tsplus_module_5 from "@
|
|
6
|
-
import * as tsplus_module_6 from "
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/
|
|
8
|
-
import * as tsplus_module_8 from "callbag-effect-ts/Source/
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "@effect/io/
|
|
3
|
+
import * as tsplus_module_3 from "dfx/common-gateway";
|
|
4
|
+
import * as tsplus_module_4 from "callbag-effect-ts/Sink/map";
|
|
5
|
+
import * as tsplus_module_5 from "@fp-ts/data/Duration";
|
|
6
|
+
import * as tsplus_module_6 from "@effect/io/Schedule";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/tapError";
|
|
8
|
+
import * as tsplus_module_8 from "callbag-effect-ts/Source/retry";
|
|
9
|
+
import * as tsplus_module_9 from "callbag-effect-ts/Source/map";
|
|
10
|
+
import * as tsplus_module_10 from "@effect/io/Effect";
|
|
11
|
+
import * as tsplus_module_11 from "@effect/io/Ref";
|
|
11
12
|
export const DiscordWSCodec = tsplus_module_1.Tag();
|
|
12
13
|
export const LiveJsonDiscordWSCodec = tsplus_module_2.succeed(DiscordWSCodec)({
|
|
13
14
|
type: "json",
|
|
14
15
|
encode: (p) => JSON.stringify(p),
|
|
15
16
|
decode: (p) => JSON.parse(p.toString("utf8")),
|
|
16
17
|
});
|
|
17
|
-
export const make = ({ url = "wss://gateway.discord.gg/", version = 10, } = {}) =>
|
|
18
|
-
const setUrl = (url) =>
|
|
19
|
-
return
|
|
20
|
-
const source =
|
|
21
|
-
const sink =
|
|
18
|
+
export const make = ({ url = "wss://gateway.discord.gg/", version = 10, } = {}) => tsplus_module_10.flatMap(encoding => tsplus_module_10.flatMap(urlRef => {
|
|
19
|
+
const setUrl = (url) => tsplus_module_11.set(`${url}?v=${version}&encoding=${encoding.type}`)(urlRef);
|
|
20
|
+
return tsplus_module_10.flatMap(ws => tsplus_module_10.map(log => {
|
|
21
|
+
const source = tsplus_module_9.map(encoding.decode)(tsplus_module_8.retry(tsplus_module_6.exponential(tsplus_module_5.seconds(0.5)))(tsplus_module_7.tapError((e) => log.info("DiscordWS", "ERROR", e))(ws.source)));
|
|
22
|
+
const sink = tsplus_module_4.map((msg) => msg === tsplus_module_3.WS.Reconnect ? msg : encoding.encode(msg))(ws.sink);
|
|
22
23
|
return { source, sink, setUrl };
|
|
23
|
-
})(
|
|
24
|
-
})(
|
|
24
|
+
})(tsplus_module_10.service(tsplus_module_1.Log.Log)))(tsplus_module_3.WS.make(urlRef, { perMessageDeflate: false }));
|
|
25
|
+
})(tsplus_module_11.make(`${url}?v=${version}&encoding=${encoding.type}`)))(tsplus_module_10.service(DiscordWSCodec));
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAeA,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAc,cAAc,CAAC,CAAC;IAClE,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,GAAG,GAAG,2BAA2B,EACjC,OAAO,GAAG,EAAE,MACA,EAAE,EAAE,EAAE,0BAEV,QAAQ,6BACR,MAAM;IACZ,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,qBAAW,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,EAA1D,MAAM,CAAqD,CAAA;oCAEvD,EAAE,yBAEF,GAAG;QACT,MAAM,MAAM,GAAG,oBAGR,QAAQ,CAAC,MAAM,EAHP,sBAEN,4BAAqB,wBAAiB,GAAG,CAAC,CAAC,EAFrC,yBACH,CAAC,CAAM,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,EAD1C,EAAE,CAAC,MAAM,CACkC,CACL,CAKpD,CAAA;QAED,MAAM,IAAI,GAAG,oBAAY,CAAC,GAAY,EAAE,EAAE,CACxC,GAAG,KAAK,gBAAA,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EADtC,EAAE,CAAC,IAAI,CAEnB,CAAA;QAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;OAdjB,yBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,GAFxB,gBAAA,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;GAJzC,sBAAS,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,CAAC,GADvD,yBAAe,cAAc,CAAC,CAsBjD,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { Ref, Maybe, Effect,
|
|
1
|
+
import { Ref, Maybe, Effect, EffectSource, Discord } from "dfx/common";
|
|
2
|
+
import { DWS } from "dfx/common-gateway";
|
|
2
3
|
export declare const fromRaw: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, seqRef: Ref<Maybe<number>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
3
4
|
//# sourceMappingURL=heartbeats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeats.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heartbeats.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":";;AAeA,eAAO,MAAM,OAAO,8HAEV,IAAI,MAAM,MAAM,CAAC,CAAC,mGAqBjB,CAAA"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Ref";
|
|
2
2
|
import * as tsplus_module_2 from "@fp-ts/data/Option";
|
|
3
3
|
import * as tsplus_module_3 from "@effect/io/Effect";
|
|
4
|
-
import * as tsplus_module_4 from "dfx/common";
|
|
4
|
+
import * as tsplus_module_4 from "dfx/common-gateway";
|
|
5
5
|
import * as tsplus_module_5 from "@effect/io/Schedule";
|
|
6
6
|
import * as tsplus_module_6 from "callbag-effect-ts/Source/fromSchedule";
|
|
7
|
-
import * as tsplus_module_7 from "
|
|
8
|
-
import * as tsplus_module_8 from "callbag-effect-ts/Source/
|
|
9
|
-
import * as tsplus_module_9 from "callbag-effect-ts/Source/
|
|
10
|
-
import * as tsplus_module_10 from "callbag-effect-ts/Source/
|
|
11
|
-
import * as tsplus_module_11 from "callbag-effect-ts/Source/
|
|
12
|
-
import * as tsplus_module_12 from "callbag-effect-ts/Source/
|
|
7
|
+
import * as tsplus_module_7 from "dfx/common";
|
|
8
|
+
import * as tsplus_module_8 from "callbag-effect-ts/Source/tap";
|
|
9
|
+
import * as tsplus_module_9 from "callbag-effect-ts/Source/switchMap";
|
|
10
|
+
import * as tsplus_module_10 from "callbag-effect-ts/Source/mapEffect";
|
|
11
|
+
import * as tsplus_module_11 from "callbag-effect-ts/Source/drain";
|
|
12
|
+
import * as tsplus_module_12 from "callbag-effect-ts/Source/merge";
|
|
13
|
+
import * as tsplus_module_13 from "callbag-effect-ts/Source/unwrap";
|
|
13
14
|
import { millis } from "@fp-ts/data/Duration";
|
|
14
15
|
import * as SendEvents from "./sendEvents.js";
|
|
15
16
|
import * as Utils from "./utils.js";
|
|
16
17
|
const send = (ref, seqRef) => tsplus_module_3.tap(() => tsplus_module_1.set(false)(ref))(tsplus_module_3.map((a) => SendEvents.heartbeat(tsplus_module_2.getOrNull(a)))(tsplus_module_1.get(seqRef)));
|
|
17
18
|
const maybeSend = (ref, seqRef) => tsplus_module_3.flatMap((acked) => acked ? send(ref, seqRef) : tsplus_module_3.succeed(tsplus_module_4.WS.Reconnect))(tsplus_module_1.get(ref));
|
|
18
|
-
export const fromRaw = (source, seqRef) =>
|
|
19
|
-
const heartbeats =
|
|
20
|
-
const acks =
|
|
21
|
-
return
|
|
19
|
+
export const fromRaw = (source, seqRef) => tsplus_module_13.unwrap(tsplus_module_3.map((ackedRef) => {
|
|
20
|
+
const heartbeats = tsplus_module_10.mapEffect(() => maybeSend(ackedRef, seqRef))(tsplus_module_9.switchMap((p) => tsplus_module_6.fromSchedule(tsplus_module_5.andThen(tsplus_module_5.spaced(millis(p.d.heartbeat_interval)))(tsplus_module_5.duration(millis(p.d.heartbeat_interval * Math.random())))))(tsplus_module_8.tap(() => tsplus_module_1.set(true)(ackedRef))(Utils.opCode(source)(tsplus_module_7.Discord.GatewayOpcode.HELLO))));
|
|
21
|
+
const acks = tsplus_module_11.drain(tsplus_module_8.tap(() => tsplus_module_1.set(true)(ackedRef))(Utils.opCode(source)(tsplus_module_7.Discord.GatewayOpcode.HEARTBEAT_ACK)));
|
|
22
|
+
return tsplus_module_12.merge(acks)(heartbeats);
|
|
22
23
|
})(tsplus_module_1.make(true)));
|
|
23
24
|
//# sourceMappingURL=heartbeats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeats.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heartbeats.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,MAAM,IAAI,GAAG,CAAC,GAAiB,EAAE,MAA0B,EAAE,EAAE,CAC7D,oBAEO,GAAG,EAAE,CAAC,oBA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,IAAI,EAArB,UAAU,CAAY,CAAA;AAC/B,CAAC,EAnBD,qBAAS,IAAI,CAAC,CAmBZ,CAAO,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DWS
|
|
1
|
+
import { DWS } from "dfx/common-gateway";
|
|
2
|
+
import { Discord } from "dfx/common";
|
|
2
3
|
export declare const make: (shard: [id: number, count: number]) => import("../../common.js").Effect<import("../../DiscordConfig/index.js").DiscordConfig | import("../../Log/index.js").Log | import("../../RateLimitStore/index.js").RateLimiter | import("../DiscordWS/index.js").DiscordWSCodec, never, {
|
|
3
4
|
run: import("../../common.js").Effect<never, never, readonly [readonly [readonly [readonly [void, void], void], void], void]>;
|
|
4
5
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":";;AAKA,eAAO,MAAM,IAAI,UAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;;;;cAiFvC,QAAQ,cAAc;;EAGlC,CAAA"}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
-
import * as tsplus_module_2 from "dfx/common";
|
|
2
|
+
import * as tsplus_module_2 from "dfx/common-gateway";
|
|
3
3
|
import * as tsplus_module_3 from "callbag-effect-ts/Source/forEach";
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
5
|
-
import * as tsplus_module_5 from "callbag-effect-ts/Source/
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/
|
|
7
|
-
import * as tsplus_module_7 from "
|
|
8
|
-
import * as tsplus_module_8 from "
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "
|
|
4
|
+
import * as tsplus_module_4 from "dfx/common";
|
|
5
|
+
import * as tsplus_module_5 from "callbag-effect-ts/Source/filter";
|
|
6
|
+
import * as tsplus_module_6 from "callbag-effect-ts/Source/tap";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/run";
|
|
8
|
+
import * as tsplus_module_8 from "@fp-ts/data/Option";
|
|
9
|
+
import * as tsplus_module_9 from "callbag-effect-ts/Source/share";
|
|
10
|
+
import * as tsplus_module_10 from "@fp-ts/data/Duration";
|
|
11
|
+
import * as tsplus_module_11 from "callbag-effect-ts/Source/async";
|
|
11
12
|
import * as Heartbeats from "./heartbeats.js";
|
|
12
13
|
import * as Identify from "./identify.js";
|
|
13
14
|
import * as InvalidSession from "./invalidSession.js";
|
|
14
15
|
import * as Utils from "./utils.js";
|
|
15
16
|
export const make = (shard) => tsplus_module_1.flatMap(({ token, gateway }) => tsplus_module_1.flatMap(socket => {
|
|
16
|
-
const [emit, outgoing] =
|
|
17
|
+
const [emit, outgoing] = tsplus_module_11.asyncEmitter();
|
|
17
18
|
return tsplus_module_1.flatMap(limiter => {
|
|
18
|
-
const sendEffect =
|
|
19
|
+
const sendEffect = tsplus_module_7.run(tsplus_module_6.tap(() => limiter.maybeWait("shard.send", tsplus_module_10.minutes(1), 120))(outgoing), socket.sink);
|
|
19
20
|
return tsplus_module_1.flatMap(raw => {
|
|
20
21
|
const sendMessage = (a) => tsplus_module_1.sync(() => {
|
|
21
22
|
emit.data(a);
|
|
22
23
|
});
|
|
23
24
|
return tsplus_module_1.flatMap(([latestReady, updateLatestReady]) => tsplus_module_1.map(([latestSequence, updateLatestSequence]) => {
|
|
24
|
-
const maybeUpdateUrl = (p) =>
|
|
25
|
-
const updateRefs =
|
|
25
|
+
const maybeUpdateUrl = (p) => tsplus_module_8.match(() => tsplus_module_1.unit(), (a) => socket.setUrl(a.resume_gateway_url))(tsplus_module_8.map((p) => p.d)(tsplus_module_8.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_8.some(p))));
|
|
26
|
+
const updateRefs = tsplus_module_7.runDrain(tsplus_module_6.tap(maybeUpdateUrl)(tsplus_module_6.tap(updateLatestSequence)(tsplus_module_6.tap(updateLatestReady)(raw))));
|
|
26
27
|
// heartbeats
|
|
27
28
|
const heartbeatEffects = tsplus_module_3.forEach(sendMessage)(Heartbeats.fromRaw(raw, latestSequence));
|
|
28
|
-
const dispatch =
|
|
29
|
+
const dispatch = tsplus_module_5.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH)(raw);
|
|
29
30
|
// identify
|
|
30
31
|
const identifyEffects = tsplus_module_3.forEach(sendMessage)(Identify.fromRaw(raw, {
|
|
31
32
|
token,
|
|
@@ -44,8 +45,8 @@ export const make = (shard) => tsplus_module_1.flatMap(({ token, gateway }) => t
|
|
|
44
45
|
send: (p) => emit.data(p),
|
|
45
46
|
reconnect: () => emit.data(tsplus_module_2.WS.Reconnect),
|
|
46
47
|
};
|
|
47
|
-
})(Utils.latest((p) =>
|
|
48
|
-
})(
|
|
49
|
-
})(tsplus_module_1.service(
|
|
50
|
-
})(tsplus_module_2.DWS.make()))(tsplus_module_1.service(
|
|
48
|
+
})(Utils.latest((p) => tsplus_module_8.fromNullable(p.s))))(Utils.latest((p) => tsplus_module_8.map((p) => p.d)(tsplus_module_8.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_8.some(p)))));
|
|
49
|
+
})(tsplus_module_9.share(socket.source));
|
|
50
|
+
})(tsplus_module_1.service(tsplus_module_4.RateLimitStore.RateLimiter));
|
|
51
|
+
})(tsplus_module_2.DWS.make()))(tsplus_module_1.service(tsplus_module_4.Config.DiscordConfig));
|
|
51
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAkC,EAAE,EAAE,0BAEjD,EAAE,KAAK,EAAE,OAAO,EAAE,6BAElB,MAAM;IAEZ,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,+BAA+C,CAAA;mCAClE,OAAO;QACb,MAAM,UAAU,GAAG,oBAAA,oBACZ,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,EAAE,yBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,EADnD,QAAQ,CAC4C,EAChE,MAAM,CAAC,IAAI,CAAC,CAAA;uCAEb,GAAG;YACT,MAAM,WAAW,GAAG,CAAC,CAAc,EAAE,EAAE,CACrC,qBAAY,GAAG,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACd,CAAC,CAAC,CAAA;4CAEE,CAAC,WAAW,EAAE,iBAAiB,CAAC,0BAUhC,CAAC,cAAc,EAAE,oBAAoB,CAAC;gBAG5C,MAAM,cAAc,GAAG,CAAC,CAAyB,EAAE,EAAE,CACnD,sBAOI,GAAG,EAAE,CAAC,sBAAa,EACnB,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAR9C,oBAKO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EALlB,uBAEI,CAAC,CAAC,EAAmD,EAAE,CACrD,CAAC,CAAC,EAAE,KA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AC;iBACzC,CAAA;eAtDC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,6BAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,GAV5C,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACjB,oBAKO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EALlB,uBAEI,CAAC,CAAC,EAAmD,EAAE,CACrD,CAAC,CAAC,EAAE,KAAK,gBAAA,OAAO,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAHhE,qBAAW,CAAC,CAAC,CAIV,CACgB,CACpB;iCAdW,MAAM,CAAC,MAAM;OALT,wBAAe,gBAAA,cAAc,CAAC,WAAW,CAAC;GAH3C,gBAAA,GAAG,CAAC,IAAI,EAAE,GAFE,wBAAe,gBAAA,MAAM,CAAC,aAAa,CAAC,CAkFjE,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { EffectSource, Discord, Ref, Maybe
|
|
1
|
+
import { EffectSource, Discord, Ref, Maybe } from "dfx/common";
|
|
2
|
+
import { DWS } from "dfx/common-gateway";
|
|
2
3
|
export declare const fromRaw: <R, E>(raw: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, latestReady: Ref<Maybe<Discord.ReadyEvent>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
3
4
|
//# sourceMappingURL=invalidSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidSession.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalidSession.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":";;AAEA,eAAO,MAAM,OAAO,gIAEL,IAAI,MAAM,QAAQ,UAAU,CAAC,CAAC,mGAMJ,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "dfx/common";
|
|
1
|
+
import * as tsplus_module_1 from "dfx/common-gateway";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
3
|
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
4
|
import * as tsplus_module_4 from "@effect/io/Ref";
|
|
5
|
-
import * as tsplus_module_5 from "
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/
|
|
5
|
+
import * as tsplus_module_5 from "dfx/common";
|
|
6
|
+
import * as tsplus_module_6 from "callbag-effect-ts/Source/tap";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/map";
|
|
7
8
|
import { opCode } from "./utils.js";
|
|
8
|
-
export const fromRaw = (raw, latestReady) =>
|
|
9
|
+
export const fromRaw = (raw, latestReady) => tsplus_module_7.map(() => tsplus_module_1.WS.Reconnect)(tsplus_module_6.tap((p) => (p.d ? tsplus_module_2.unit() : tsplus_module_4.set(tsplus_module_3.none)(latestReady)))(opCode(raw)(tsplus_module_5.Discord.GatewayOpcode.INVALID_SESSION)));
|
|
9
10
|
//# sourceMappingURL=invalidSession.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidSession.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalidSession.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAA+C,EAC/C,WAA2C,EAC3C,EAAE,CACF,oBAIO,GAAgB,EAAE,CAAC,gBAAA,EAAE,CAAC,SAAS,EAJtC,oBAGO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAa,CAAC,CAAC,CAAC,0CAAA,WAAW,CAAgB,CAAC,EAHjE,MAAM,CAAC,GAAG,CAAC,CACT,gBAAA,OAAO,CAAC,aAAa,CAAC,eAAe,CACtC,CACiE,CAC3B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Maybe, EffectSource, Discord } from "dfx/common";
|
|
2
2
|
import { ShardStore } from "../ShardStore/index.js";
|
|
3
|
-
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<import("../../
|
|
3
|
+
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<ShardStore | import("../../index.js").DiscordREST | import("../../DiscordConfig/index.js").DiscordConfig | import("../../Log/index.js").Log | import("../../RateLimitStore/index.js").RateLimiter | import("../DiscordWS/index.js").DiscordWSCodec, never, {
|
|
4
4
|
run: import("../../common.js").Effect<never, never, readonly [readonly [readonly [readonly [void, void], void], void], void]>;
|
|
5
5
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
6
6
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
@@ -6,14 +6,15 @@ import * as tsplus_module_5 from "@fp-ts/data/Option";
|
|
|
6
6
|
import * as tsplus_module_6 from "callbag-effect-ts/Source/empty";
|
|
7
7
|
import * as tsplus_module_7 from "@effect/io/Effect";
|
|
8
8
|
import * as tsplus_module_8 from "callbag-effect-ts/Source/of";
|
|
9
|
-
import * as tsplus_module_9 from "dfx/common";
|
|
9
|
+
import * as tsplus_module_9 from "dfx/common-gateway";
|
|
10
10
|
import * as tsplus_module_10 from "callbag-effect-ts/Source/tap";
|
|
11
11
|
import * as tsplus_module_11 from "callbag-effect-ts/Source/mapEffect";
|
|
12
12
|
import * as tsplus_module_12 from "callbag-effect-ts/Source/groupBy";
|
|
13
13
|
import * as tsplus_module_13 from "callbag-effect-ts/Source/chainPar";
|
|
14
|
-
import * as tsplus_module_14 from "
|
|
15
|
-
import * as tsplus_module_15 from "callbag-effect-ts/Source/
|
|
16
|
-
import * as tsplus_module_16 from "callbag-effect-ts/Source/
|
|
14
|
+
import * as tsplus_module_14 from "dfx/common";
|
|
15
|
+
import * as tsplus_module_15 from "callbag-effect-ts/Source/drain";
|
|
16
|
+
import * as tsplus_module_16 from "callbag-effect-ts/Source/merge";
|
|
17
|
+
import * as tsplus_module_17 from "callbag-effect-ts/Source/unwrap";
|
|
17
18
|
import { millis } from "@fp-ts/data/Duration";
|
|
18
19
|
import { overridePull } from "callbag-effect-ts/Source";
|
|
19
20
|
import { ShardStore } from "../ShardStore/index.js";
|
|
@@ -51,10 +52,10 @@ const spawnEffect = tsplus_module_7.map(({ gateway, config, configs, limiter })
|
|
|
51
52
|
reset_after: 0,
|
|
52
53
|
max_concurrency: 1,
|
|
53
54
|
},
|
|
54
|
-
}))(tsplus_module_7.flatMap((r) => r.json)(
|
|
55
|
+
}))(tsplus_module_7.flatMap((r) => r.json)(tsplus_module_14.Rest.rest
|
|
55
56
|
.getGatewayBot())),
|
|
56
|
-
config:
|
|
57
|
-
limiter: tsplus_module_7.service(
|
|
57
|
+
config: tsplus_module_14.Config.gateway,
|
|
58
|
+
limiter: tsplus_module_7.service(tsplus_module_14.RateLimitStore.RateLimiter),
|
|
58
59
|
})));
|
|
59
|
-
export const spawn = tsplus_module_13.chainPar((shard) =>
|
|
60
|
+
export const spawn = tsplus_module_13.chainPar((shard) => tsplus_module_16.merge(tsplus_module_15.drain(tsplus_module_1.fromEffect(shard.run)))(tsplus_module_8.of(shard)))(tsplus_module_17.unwrap(spawnEffect));
|
|
60
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Sharder/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../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AA,MAAM,CAAC,OAAO;IACtB,OAAO,EAAE,wBAAe,iBAAA,cAAc,CAAC,WAAW,CAAC;CACpD,CAAC,CAGC,CA0BC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG,0BAA4B,CAAC,KAAK,EAAE,EAAE,CACzD,8CAA6B,2BAAwB,KAAK,CAAC,GAAG,CAAC,GAA/D,mBAAgB,KAAK,CAAC,CAAgD,0BADnD,WAAW,EAE/B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EffectSource, Discord, Effect } from "dfx/common";
|
|
2
2
|
import { Success } from "dfx/utils/effect";
|
|
3
|
-
export declare const make: import("../common.js").Effect<import("
|
|
3
|
+
export declare const make: import("../common.js").Effect<import("./ShardStore/index.js").ShardStore | import("../index.js").DiscordREST | import("../DiscordConfig/index.js").DiscordConfig | import("../Log/index.js").Log | import("../RateLimitStore/index.js").RateLimiter | import("./DiscordWS/index.js").DiscordWSCodec, never, {
|
|
4
4
|
shards: import("callbag-effect-ts/Source").EffectSource<never, never, {
|
|
5
5
|
run: import("../common.js").Effect<never, never, readonly [readonly [readonly [readonly [void, void], void], void], void]>;
|
|
6
6
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
|
|
@@ -16,6 +16,6 @@ export declare const make: import("../common.js").Effect<import("../DiscordConfi
|
|
|
16
16
|
export interface DiscordGateway extends Success<typeof make> {
|
|
17
17
|
}
|
|
18
18
|
export declare const DiscordGateway: import("../common.js").Tag<DiscordGateway>;
|
|
19
|
-
export declare const LiveDiscordGateway: import("../common.js").Layer<import("
|
|
19
|
+
export declare const LiveDiscordGateway: import("../common.js").Layer<import("./ShardStore/index.js").ShardStore | import("../index.js").DiscordREST | import("../DiscordConfig/index.js").DiscordConfig | import("../Log/index.js").Log | import("../RateLimitStore/index.js").RateLimiter | import("./DiscordWS/index.js").DiscordWSCodec, never, DiscordGateway>;
|
|
20
20
|
export declare const handleDispatch: <K extends keyof import("../types.js").ReceiveEvents, R1, E1, A>(event: K, handle: (event: import("../types.js").ReceiveEvents[K]) => import("../common.js").Effect<R1, E1, A>) => import("../common.js").Effect<DiscordGateway | R1, E1, void>;
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Effect, Http } from "dfx/common";
|
|
2
2
|
import { Success } from "dfx/utils/effect";
|
|
3
3
|
import { ResponseWithData } from "./types.js";
|
|
4
|
-
declare const make: import("../common.js").Effect<import("../DiscordConfig/index.js").DiscordConfig | import("
|
|
4
|
+
declare const make: import("../common.js").Effect<import("../DiscordConfig/index.js").DiscordConfig | import("../Log/index.js").Log | import("dfx/RateLimitStore/index").RateLimitStore | import("dfx/RateLimitStore/index").RateLimiter, never, {
|
|
5
5
|
request: <A = unknown>(path: string, init?: RequestInit) => import("../common.js").Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError, ResponseWithData<A>>;
|
|
6
6
|
}>;
|
|
7
7
|
export interface DiscordREST extends Success<typeof make> {
|
|
8
8
|
}
|
|
9
9
|
export declare const DiscordREST: import("../common.js").Tag<DiscordREST>;
|
|
10
|
-
export declare const LiveDiscordREST: import("../common.js").Layer<import("../DiscordConfig/index.js").DiscordConfig | import("
|
|
10
|
+
export declare const LiveDiscordREST: import("../common.js").Layer<import("../DiscordConfig/index.js").DiscordConfig | import("../Log/index.js").Log | import("dfx/RateLimitStore/index").RateLimitStore | import("dfx/RateLimitStore/index").RateLimiter, never, DiscordREST>;
|
|
11
11
|
export declare const rest: import("../types.js").Endpoints<RequestInit>;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -22,7 +22,7 @@ export declare class ResolvedDataNotFound {
|
|
|
22
22
|
export declare const getResolved: <A>(name: string, f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => A | undefined) => import("../common.js").Effect<import("../types.js").ApplicationCommandDatum, ResolvedDataNotFound, A>;
|
|
23
23
|
export declare const focusedOptionValue: import("../common.js").Effect<FocusedOptionContext, never, string>;
|
|
24
24
|
export declare const commandOptionsMap: import("../common.js").Effect<import("../types.js").ApplicationCommandDatum, never, Record<string, string | undefined>>;
|
|
25
|
-
export declare const handleSubCommands: <NER extends Record<string, import("../common.js").Effect<any, any, InteractionResponse>>>(commands: NER) => import("../common.js").Effect<import("../types.js").
|
|
25
|
+
export declare const handleSubCommands: <NER extends Record<string, import("../common.js").Effect<any, any, InteractionResponse>>>(commands: NER) => import("../common.js").Effect<import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum | Exclude<[NER[keyof NER]] extends [{
|
|
26
26
|
[EffectTypeId]: {
|
|
27
27
|
_R: (_: never) => infer R;
|
|
28
28
|
};
|
|
@@ -28,14 +28,14 @@ export declare class GlobalApplicationCommand<R, E> {
|
|
|
28
28
|
readonly _tag = "GlobalApplicationCommand";
|
|
29
29
|
constructor(command: Discord.CreateGlobalApplicationCommandParams, handle: Effect<R, E, Maybe<InteractionResponse>>);
|
|
30
30
|
}
|
|
31
|
-
export declare const global: <R, E, A extends import("../types.js").CreateGlobalApplicationCommandParams>(command: A, handle: DescriptionMissing<A> extends true ? "command description is missing" : import("../common.js").Effect<R, E, import("../common.js").Maybe<InteractionResponse>>) => GlobalApplicationCommand<Exclude<R, import("../types.js").
|
|
31
|
+
export declare const global: <R, E, A extends import("../types.js").CreateGlobalApplicationCommandParams>(command: A, handle: DescriptionMissing<A> extends true ? "command description is missing" : import("../common.js").Effect<R, E, import("../common.js").Maybe<InteractionResponse>>) => GlobalApplicationCommand<Exclude<R, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum>, E>;
|
|
32
32
|
export declare class GuildApplicationCommand<R, E> {
|
|
33
33
|
readonly command: Discord.CreateGuildApplicationCommandParams;
|
|
34
34
|
readonly handle: Effect<R, E, Maybe<InteractionResponse>>;
|
|
35
35
|
readonly _tag = "GuildApplicationCommand";
|
|
36
36
|
constructor(command: Discord.CreateGuildApplicationCommandParams, handle: Effect<R, E, Maybe<InteractionResponse>>);
|
|
37
37
|
}
|
|
38
|
-
export declare const guild: <R, E, A extends import("../types.js").CreateGuildApplicationCommandParams>(command: A, handle: DescriptionMissing<A> extends true ? "command description is missing" : import("../common.js").Effect<R, E, import("../common.js").Maybe<InteractionResponse>>) => GuildApplicationCommand<Exclude<R, import("../types.js").
|
|
38
|
+
export declare const guild: <R, E, A extends import("../types.js").CreateGuildApplicationCommandParams>(command: A, handle: DescriptionMissing<A> extends true ? "command description is missing" : import("../common.js").Effect<R, E, import("../common.js").Maybe<InteractionResponse>>) => GuildApplicationCommand<Exclude<R, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum>, E>;
|
|
39
39
|
export declare class MessageComponent<R, E> {
|
|
40
40
|
readonly predicate: (customId: string) => Effect<R, E, boolean>;
|
|
41
41
|
readonly handle: Effect<R, E, Maybe<InteractionResponse>>;
|
|
@@ -56,6 +56,6 @@ export declare class Autocomplete<R, E> {
|
|
|
56
56
|
readonly _tag = "Autocomplete";
|
|
57
57
|
constructor(predicate: (focusedOption: Discord.ApplicationCommandInteractionDataOption) => Effect<R, E, boolean>, handle: Effect<R, E, Maybe<InteractionResponse>>);
|
|
58
58
|
}
|
|
59
|
-
export declare const autocomplete: <R1, R2, E1, E2>(pred: (focusedOption: Discord.ApplicationCommandInteractionDataOption) => import("../common.js").Effect<R1, E1, boolean>, handle: import("../common.js").Effect<R2, E2, import("../common.js").Maybe<InteractionResponse>>) => Autocomplete<Exclude<R1, import("../types.js").
|
|
59
|
+
export declare const autocomplete: <R1, R2, E1, E2>(pred: (focusedOption: Discord.ApplicationCommandInteractionDataOption) => import("../common.js").Effect<R1, E1, boolean>, handle: import("../common.js").Effect<R2, E2, import("../common.js").Maybe<InteractionResponse>>) => Autocomplete<Exclude<R1, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum | import("../types.js").ApplicationCommandInteractionDataOption> | Exclude<R2, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum | import("../types.js").ApplicationCommandInteractionDataOption>, E1 | E2>;
|
|
60
60
|
export {};
|
|
61
61
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Http, Effect } from "dfx/common";
|
|
2
|
-
import
|
|
2
|
+
import { InteractionBuilder } from "./index.js";
|
|
3
3
|
export interface RunOpts {
|
|
4
4
|
sync?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const run: <R, R2, E, E2>(
|
|
6
|
+
export declare const run: <R, R2, E, E2>(ix: InteractionBuilder<R, E>, catchAll: (e: import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E) => import("../common.js").Effect<R2, E2, any>, { sync }?: RunOpts) => import("../common.js").Effect<import("../index.js").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway | R | R2, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E2, void>;
|
|
7
7
|
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/Interactions/gateway.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/Interactions/gateway.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/C,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,eAAO,MAAM,GAAG,2PAKG,OAAO,+QAwCtB,CAAA"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
2
|
import * as tsplus_module_2 from "dfx/common";
|
|
3
3
|
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
|
+
import * as tsplus_module_4 from "dfx/common-gateway";
|
|
4
5
|
import { handlers } from "./handlers.js";
|
|
5
6
|
import { splitDefinitions } from "./utils.js";
|
|
6
|
-
export const run = (
|
|
7
|
-
const { GlobalApplicationCommand, GuildApplicationCommand } = splitDefinitions(definitions);
|
|
7
|
+
export const run = (ix, catchAll, { sync = true } = {}) => (() => {
|
|
8
|
+
const { GlobalApplicationCommand, GuildApplicationCommand } = splitDefinitions(ix.definitions);
|
|
8
9
|
return tsplus_module_1.flatMap(application => {
|
|
9
10
|
const globalSync = tsplus_module_2.Rest.rest.bulkOverwriteGlobalApplicationCommands(application.id, {
|
|
10
11
|
body: JSON.stringify(GlobalApplicationCommand.map((a) => a.command)),
|
|
11
12
|
});
|
|
12
13
|
const guildSync = GuildApplicationCommand.length
|
|
13
|
-
?
|
|
14
|
+
? tsplus_module_4.Gateway.handleDispatch("GUILD_CREATE", (a) => tsplus_module_2.Rest.rest.bulkOverwriteGuildApplicationCommands(application.id, a.id, GuildApplicationCommand.map((a) => a.command)))
|
|
14
15
|
: tsplus_module_1.unit();
|
|
15
|
-
const handle = handlers(definitions);
|
|
16
|
-
const run =
|
|
16
|
+
const handle = handlers(ix.definitions);
|
|
17
|
+
const run = tsplus_module_4.Gateway.handleDispatch("INTERACTION_CREATE", (i) => tsplus_module_1.catchAll(catchAll)(tsplus_module_1.tap((r) => tsplus_module_3.match(tsplus_module_1.unit, (r) => tsplus_module_2.Rest.rest.createInteractionResponse(i.id, i.token, r))(r))(handle[i.type](i))));
|
|
17
18
|
return tsplus_module_1.map(() => void 0)(sync ? tsplus_module_1.zipPar(guildSync)(tsplus_module_1.zipPar(globalSync)(run)) : run);
|
|
18
19
|
})(tsplus_module_1.flatMap((a) => a.json)(tsplus_module_2.Rest.rest.getCurrentBotApplicationInformation()));
|
|
19
20
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/Interactions/gateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/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I,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EADvD,CAAC,CAEA,EAJL,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAKd,CACkB,CACtB,CAAA;iDAEC,IAAI,CAAC,CAAC,CAAC,uBAA8B,SAAS,EAAvC,uBAAW,UAAU,EAArB,GAAG,CAAmB,CAAkB,CAAC,CAAC,CAAC,GAAG;OAhCrD,wBAAwD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAArE,gBAAA,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,CAAuB;IAiCxE,CAAA"}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Rest, Discord } from "dfx/common";
|
|
2
2
|
import * as D from "./definitions.js";
|
|
3
|
-
import * as Gateway from "./gateway.js";
|
|
4
|
-
import * as Webhook from "./webhook.js";
|
|
5
3
|
export * from "./context.js";
|
|
6
4
|
export { global, guild, messageComponent, modalSubmit, autocomplete, InteractionDefinition, InteractionResponse, } from "./definitions.js";
|
|
7
|
-
export { makeConfig as makeWebhookConfig, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./webhook.js";
|
|
8
|
-
export
|
|
9
|
-
headers: Webhook.Headers;
|
|
10
|
-
body: string;
|
|
11
|
-
success: (a: Discord.InteractionResponse) => Effect<never, never, void>;
|
|
12
|
-
error: (e: Cause<E>) => Effect<never, never, void>;
|
|
13
|
-
empty: Effect<never, never, void>;
|
|
14
|
-
}
|
|
15
|
-
declare class InteractionBuilder<R, E> {
|
|
5
|
+
export { makeConfig as makeWebhookConfig, makeHandler as makeWebhookHandler, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./webhook.js";
|
|
6
|
+
export declare class InteractionBuilder<R, E> {
|
|
16
7
|
readonly definitions: D.InteractionDefinition<R, E>[];
|
|
17
8
|
constructor(definitions: D.InteractionDefinition<R, E>[]);
|
|
18
9
|
add<R1, E1>(definition: D.InteractionDefinition<R1, E1>): InteractionBuilder<R | R1, E | E1>;
|
|
19
|
-
runGateway<R2, E2>(catchAll: (e: E | Http.FetchError | Http.StatusCodeError | Http.JsonParseError) => Effect<R2, E2, any>, opts?: Gateway.RunOpts): import("../common.js").Effect<import("../index.js").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway | R | R2, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E2, void>;
|
|
20
|
-
makeWebhookHandler(): ({ headers, body, success, empty, error, }: HandleWebhookOpts<E | Webhook.WebhookParseError | Webhook.BadWebhookSignature>) => import("../common.js").Effect<Webhook.WebhookConfig | R, never, void>;
|
|
21
10
|
get syncGlobal(): import("../common.js").Effect<import("../index.js").DiscordREST, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<import("../types.js").ApplicationCommand[]>>;
|
|
22
11
|
syncGuild(appId: Discord.Snowflake, guildId: Discord.Snowflake): import("../DiscordREST/types.js").RestResponse<import("../types.js").ApplicationCommand[]>;
|
|
23
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAA;AAErC,cAAc,cAAc,CAAA;AAE5B,OAAO,EACL,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,UAAU,IAAI,iBAAiB,EAC/B,WAAW,IAAI,kBAAkB,EACjC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,cAAc,CAAA;AAErB,qBAAa,kBAAkB,CAAC,CAAC,EAAE,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;gBAA5C,WAAW,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;IAEjE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC;IAOvD,IAAI,UAAU,qSAgBb;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS;CAc/D;AAED,eAAO,MAAM,OAAO,kCAA2C,CAAA;AAG/D,eAAO,MAAM,EAAE,UAAW,MAAM,gBAAgB,MAAM,yDAClB,CAAA;AAEpC,eAAO,MAAM,YAAY,UAAW,MAAM,gBAAgB,MAAM,yDACpB,CAAA;AAE5C,eAAO,MAAM,KAAK,UAAW,MAAM,gBAAgB,MAAM,yDACnB,CAAA;AAEtC,eAAO,MAAM,MAAM,SACV,MAAM,qBACG,QAAQ,uCAAuC,yDAClB,CAAA"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "
|
|
1
|
+
import * as tsplus_module_1 from "dfx/common";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
|
-
import * as tsplus_module_3 from "dfx/common";
|
|
4
|
-
import * as Gateway from "./gateway.js";
|
|
5
|
-
import * as Webhook from "./webhook.js";
|
|
6
3
|
export * from "./context.js";
|
|
7
4
|
export { global, guild, messageComponent, modalSubmit, autocomplete, } from "./definitions.js";
|
|
8
|
-
export { makeConfig as makeWebhookConfig, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./webhook.js";
|
|
9
|
-
class InteractionBuilder {
|
|
5
|
+
export { makeConfig as makeWebhookConfig, makeHandler as makeWebhookHandler, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./webhook.js";
|
|
6
|
+
export class InteractionBuilder {
|
|
10
7
|
definitions;
|
|
11
8
|
constructor(definitions) {
|
|
12
9
|
this.definitions = definitions;
|
|
@@ -17,27 +14,20 @@ class InteractionBuilder {
|
|
|
17
14
|
definition,
|
|
18
15
|
]);
|
|
19
16
|
}
|
|
20
|
-
runGateway(catchAll, opts = {}) {
|
|
21
|
-
return Gateway.run(this.definitions, catchAll, opts);
|
|
22
|
-
}
|
|
23
|
-
makeWebhookHandler() {
|
|
24
|
-
const handle = Webhook.run(this.definitions);
|
|
25
|
-
return ({ headers, body, success, empty, error, }) => tsplus_module_2.catchAllCause(error)(tsplus_module_2.flatMap((o) => tsplus_module_1.match(() => empty, (a) => success(a))(o))(handle(headers, body)));
|
|
26
|
-
}
|
|
27
17
|
get syncGlobal() {
|
|
28
18
|
const commands = this.definitions
|
|
29
19
|
.filter((c) => c._tag === "GlobalApplicationCommand")
|
|
30
20
|
.map((c) => c.command);
|
|
31
|
-
return tsplus_module_2.flatMap((app) =>
|
|
21
|
+
return tsplus_module_2.flatMap((app) => tsplus_module_1.Rest.rest.bulkOverwriteGlobalApplicationCommands(app.id, {
|
|
32
22
|
body: JSON.stringify(commands),
|
|
33
|
-
}))(tsplus_module_2.flatMap((r) => r.json)(
|
|
23
|
+
}))(tsplus_module_2.flatMap((r) => r.json)(tsplus_module_1.Rest.rest
|
|
34
24
|
.getCurrentBotApplicationInformation()));
|
|
35
25
|
}
|
|
36
26
|
syncGuild(appId, guildId) {
|
|
37
27
|
const commands = this.definitions
|
|
38
28
|
.filter((c) => c._tag === "GuildApplicationCommand")
|
|
39
29
|
.map((c) => c.command);
|
|
40
|
-
return
|
|
30
|
+
return tsplus_module_1.Rest.rest.bulkOverwriteGuildApplicationCommands(appId, guildId, commands);
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
33
|
export const builder = new InteractionBuilder([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":";;AAEA,cAAc,cAAc,CAAA;AAE5B,OAAO,EACL,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,GAGb,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,UAAU,IAAI,iBAAiB,EAC/B,WAAW,IAAI,kBAAkB,EACjC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,cAAc,CAAA;AAErB,MAAM,OAAO,kBAAkB;IACR;IAArB,YAAqB,WAA4C;QAA5C,gBAAW,GAAX,WAAW,CAAiC;IAAG,CAAC;IAErE,GAAG,CAAS,UAA2C;QACrD,OAAO,IAAI,kBAAkB,CAAiB;YAC5C,GAAG,IAAI,CAAC,WAAW;YACnB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW;aAC9B,MAAM,CACL,CAAC,CAAC,EAAyC,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,0BAA0B,CACxC;aACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QAExB,OAAO,wBAGI,CAAC,GAAG,EAAE,EAAE,CACf,gBAAA,IAAI,CAAC,IAAI,CAAC,sCAAsC,CAAC,GAAG,CAAC,EAAE,EAAE;YACvD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC/B,CAAC,EANC,wBAEI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAFjB,gBAAA,IAAI,CAAC,IAAI;aACb,mCAAmC,EAAE,CACf,CAKtB,CAAA;IACL,CAAC;IAED,S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
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/Interactions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAA;AAErC,eAAO,MAAM,gBAAgB;;;;;;;CAwC5B,CAAA"}
|