Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.4 KB

README.md

File metadata and controls

40 lines (33 loc) · 1.4 KB

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)
    }
}