From e37d4ab9baaac0e4b30b19b100a812bac785fcb9 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 16 Feb 2024 22:41:32 +1300 Subject: [PATCH] remove rest response .asUnit --- src/DiscordREST.ts | 10 +++++----- src/DiscordREST/types.ts | 4 ++-- src/Interactions/gateway.ts | 16 +++++++--------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/DiscordREST.ts b/src/DiscordREST.ts index 477ce9c..7e943b9 100644 --- a/src/DiscordREST.ts +++ b/src/DiscordREST.ts @@ -256,7 +256,7 @@ const make = Effect.gen(function* (_) { }) class RestResponseImpl - extends Effectable.Class, DiscordRESTError, Scope> + extends Effectable.Class, DiscordRESTError> implements RestResponse { constructor( @@ -269,16 +269,16 @@ class RestResponseImpl super() } - commit(): Effect.Effect, DiscordRESTError, Scope> { - return this.response + commit(): Effect.Effect, DiscordRESTError> { + return Effect.scoped(this.response) } get json() { return Effect.scoped(Effect.flatMap(this.response, _ => _.json)) } - get asUnit() { - return Effect.scoped(this.response) + get response() { + return this.response } } diff --git a/src/DiscordREST/types.ts b/src/DiscordREST/types.ts index 06e9e28..1c061c5 100644 --- a/src/DiscordREST/types.ts +++ b/src/DiscordREST/types.ts @@ -8,7 +8,7 @@ export interface ResponseWithData extends Http.response.ClientResponse { } export interface RestResponse - extends Effect.Effect, DiscordRESTError, Scope> { + extends Effect.Effect, DiscordRESTError> { readonly json: Effect.Effect - readonly asUnit: Effect.Effect + readonly response: Effect.Effect, DiscordRESTError, Scope> } diff --git a/src/Interactions/gateway.ts b/src/Interactions/gateway.ts index c4b594a..f065098 100644 --- a/src/Interactions/gateway.ts +++ b/src/Interactions/gateway.ts @@ -83,17 +83,15 @@ export const run = GlobalApplicationCommand.map(_ => _.command), ), }, - ).asUnit + ) const guildSync = GuildApplicationCommand.length - ? gateway.handleDispatch( - "GUILD_CREATE", - a => - rest.bulkOverwriteGuildApplicationCommands( - application.id, - a.id, - GuildApplicationCommand.map(_ => _.command) as any, - ).asUnit, + ? gateway.handleDispatch("GUILD_CREATE", a => + rest.bulkOverwriteGuildApplicationCommands( + application.id, + a.id, + GuildApplicationCommand.map(_ => _.command) as any, + ), ) : Effect.never