diff --git a/src/AutoThreads.ts b/src/AutoThreads.ts index 4698b46..37b6870 100644 --- a/src/AutoThreads.ts +++ b/src/AutoThreads.ts @@ -13,7 +13,6 @@ import { pipe, seconds, } from "bot/_common" -import { logRESTError } from "bot/utils/Errors" import * as Str from "bot/utils/String" import { Discord, DiscordREST, Ix, Log, Perms, UI } from "dfx" import { @@ -122,7 +121,6 @@ const make = ({ topicKeyword }: AutoThreadsOptions) => ), Effect.catchTags({ NotValidMessageError: () => Effect.unit(), - DiscordRESTError: logRESTError(log), }), Effect.catchAllCause(Effect.logErrorCause), ), diff --git a/src/Mentions.ts b/src/Mentions.ts index 127e738..2d96b75 100644 --- a/src/Mentions.ts +++ b/src/Mentions.ts @@ -1,9 +1,8 @@ import { ChannelsCache, ChannelsCacheLive } from "bot/ChannelsCache" import { OpenAI, OpenAIMessage } from "bot/OpenAI" import { Data, Effect, Layer, pipe } from "bot/_common" -import { logRESTError } from "bot/utils/Errors" import * as Str from "bot/utils/String" -import { Discord, DiscordREST, Log } from "dfx" +import { Discord, DiscordREST } from "dfx" import { DiscordGateway } from "dfx/DiscordGateway" class NonEligibleMessage extends Data.TaggedClass("NonEligibleMessage")<{ @@ -15,7 +14,6 @@ const make = Effect.gen(function* (_) { const gateway = yield* _(DiscordGateway) const channels = yield* _(ChannelsCache) const openai = yield* _(OpenAI) - const log = yield* _(Log.Log) const botUser = yield* _( rest.getCurrentUser(), @@ -97,7 +95,6 @@ ${msg.content}`, Effect.catchTags({ NonEligibleMessage: _ => Effect.unit(), NoSuchElementException: _ => Effect.unit(), - DiscordRESTError: logRESTError(log), }), Effect.catchAllCause(Effect.logErrorCause), ), diff --git a/src/NoEmbed.ts b/src/NoEmbed.ts index 329cf0a..fe45667 100644 --- a/src/NoEmbed.ts +++ b/src/NoEmbed.ts @@ -1,7 +1,6 @@ import { ChannelsCache, ChannelsCacheLive } from "bot/ChannelsCache" import { Config, Data, Effect, Layer, pipe } from "bot/_common" -import { logRESTError } from "bot/utils/Errors" -import { Discord, DiscordREST, Log } from "dfx" +import { Discord, DiscordREST } from "dfx" import { DiscordGateway } from "dfx/gateway" class NotValidMessageError extends Data.TaggedClass("NotValidMessageError")<{ @@ -17,7 +16,6 @@ const make = ({ topicKeyword }: NoEmbedOptions) => const gateway = yield* _(DiscordGateway) const rest = yield* _(DiscordREST) const channels = yield* _(ChannelsCache) - const log = yield* _(Log.Log) const getChannel = (guildId: string, id: string) => Effect.flatMap(channels.get(guildId, id), _ => @@ -58,7 +56,6 @@ const make = ({ topicKeyword }: NoEmbedOptions) => ), Effect.catchTags({ NotValidMessageError: () => Effect.unit(), - DiscordRESTError: logRESTError(log), }), Effect.catchAllCause(Effect.logErrorCause), ) diff --git a/src/utils/Errors.ts b/src/utils/Errors.ts deleted file mode 100644 index 8ad6f64..0000000 --- a/src/utils/Errors.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Effect } from "bot/_common" -import { Log } from "dfx" -import { DiscordRESTError } from "dfx/DiscordREST" - -export const logRESTError = (log: Log.Log) => (_: DiscordRESTError) => - "response" in _.error - ? Effect.flatMap(_.error.response.json, _ => - Effect.logInfo(JSON.stringify(_, null, 2)), - ) - : log.info(_.error)