billzabob / dissonance   0.0.7

GitHub

A Discord framework for Scala

Scala versions: 2.13 2.12

Dissonance

A Discord framework for Scala

// available for 2.12, 2.13
libraryDependencies += "com.github.billzabob" %% "dissonance" % "version"

Example

import cats.effect._
import dissonance.data._
import dissonance.data.events._
import dissonance.Discord

object Main extends IOApp {
  override def run(args: List[String]): IO[ExitCode] =
    Discord.make(args.head).use { discord =>
      discord
        .subscribe(Shard.singleton, Intent.GuildMessages)
        .evalMap {
          case MessageCreate(BasicMessage(_, "ping", _, channelId)) =>
            discord.client.sendMessage("pong", channelId).void
          case _ => IO.unit
        }
        .compile
        .drain
        .as(ExitCode.Success)
    }
}