Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ lazy val data = crossProject(JSPlatform, JVMPlatform)
lazy val dataJVM = data.jvm
lazy val dataJS = data.js

lazy val gatewayData = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.settings(
commonSettings,
publishSettings,
name := "gateway-data",
version := ackCordVersion
)
.dependsOn(data)

lazy val gatewayDataJVM = gatewayData.jvm
lazy val gatewayDataJS = gatewayData.js

lazy val requests = project
.settings(
commonSettings,
Expand Down Expand Up @@ -101,7 +114,7 @@ lazy val gateway = project
),
Compile / doc / scalacOptions ++= Seq("-skip-packages", "akka.pattern")
)
.dependsOn(dataJVM)
.dependsOn(gatewayDataJVM)

lazy val voice = project
.settings(
Expand Down Expand Up @@ -224,6 +237,7 @@ lazy val docs = project
autoAPIMappings := true,
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(
dataJVM,
gatewayDataJVM,
requests,
gateway,
voice,
Expand Down Expand Up @@ -254,6 +268,8 @@ lazy val ackCordRoot = project
.aggregate(
dataJVM,
dataJS,
gatewayDataJVM,
gatewayDataJS,
requests,
gateway,
voice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package ackcord.gateway
import ackcord.data._
import ackcord.data.raw._
import ackcord.util.{IntCirceEnumWithUnknown, JsonOption, JsonSome, JsonUndefined}
import akka.NotUsed
import cats.{Eval, Later, Now}
import enumeratum.values.{IntEnum, IntEnumEntry}
import io.circe.Decoder.Result
Expand Down Expand Up @@ -225,9 +224,9 @@ case class Resume(nowD: ResumeData, gatewayInfo: GatewayInfo)
/**
* Sent by the gateway to indicate that the shard should reconnect.
*/
case class Reconnect(gatewayInfo: GatewayInfo) extends EagerGatewayMessage[NotUsed] with ServerGatewayMessage[NotUsed] {
case class Reconnect(gatewayInfo: GatewayInfo) extends EagerGatewayMessage[Unit] with ServerGatewayMessage[Unit] {
override def op: GatewayOpCode = GatewayOpCode.Reconnect
override def nowD: NotUsed = NotUsed
override def nowD: Unit = ()
}

/**
Expand Down Expand Up @@ -286,20 +285,18 @@ case class Hello(nowD: HelloData, gatewayInfo: GatewayInfo)
/**
* Sent by the gateway as a response to [[Heartbeat]].
*/
case class HeartbeatACK(gatewayInfo: GatewayInfo)
extends EagerGatewayMessage[NotUsed]
with ServerGatewayMessage[NotUsed] {
case class HeartbeatACK(gatewayInfo: GatewayInfo) extends EagerGatewayMessage[Unit] with ServerGatewayMessage[Unit] {
override def op: GatewayOpCode = GatewayOpCode.HeartbeatACK
override def nowD: NotUsed = NotUsed
override def nowD: Unit = ()
}

/**
* All unknown gateway messages.
*/
case class UnknownGatewayMessage(op: GatewayOpCode, gatewayInfo: GatewayInfo)
extends EagerGatewayMessage[NotUsed]
with ServerGatewayMessage[NotUsed] {
override def nowD: NotUsed = NotUsed
extends EagerGatewayMessage[Unit]
with ServerGatewayMessage[Unit] {
override def nowD: Unit = ()
}

/**
Expand Down Expand Up @@ -387,10 +384,10 @@ object GatewayEvent {
/**
* Sent to the shard when a previously interrupted connection is resumed.
*/
case class Resumed(rawData: Json) extends GatewayEvent[NotUsed] {
case class Resumed(rawData: Json) extends GatewayEvent[Unit] {
override def name: String = "RESUMED"

override def data: Later[Result[NotUsed]] = Later(Right(NotUsed))
override def data: Later[Result[Unit]] = Later(Right(()))
}

/**
Expand Down Expand Up @@ -1035,8 +1032,8 @@ object GatewayEvent {
) {

def reparse[A: Decoder]: Result[A] = {
import GatewayProtocol._
import io.circe.syntax._
import GatewayProtocol._
val self: SimpleRawInteraction = this
self.asJson.as[A]
}
Expand All @@ -1059,8 +1056,8 @@ object GatewayEvent {
) {

def reparse[A: Decoder]: Decoder.Result[A] = {
import GatewayProtocol._
import io.circe.syntax._
import GatewayProtocol._
val self: SimpleApplicationCommandWithGuildId = this
self.asJson.as[A]
}
Expand Down