Newer
Older
yuyuko-bot / src / main / scala / GensokyoBot.scala
@Илья Панфёров Илья Панфёров on 15 Jul 875 bytes fix: Update yuyuko
package social.gensokyo.discordbot

import listeners.Reactions

import ackcord._
import slick.jdbc.JdbcBackend.Database

import scala.concurrent.ExecutionContext.Implicits.global
import social.gensokyo.discordbot.listeners.Messages

class GensokyoBot(token: String)(implicit db: Database) {
  val clientSettings: ClientSettings = ClientSettings(token)
  clientSettings.createClient().map(client => {
    client.onEventSideEffectsIgnore {
      case APIMessage.Ready(_, _, _) => println("Now Ready")
      case _ =>
    }
    val reactionListeners = new Reactions(client.requests)(client)
    val messageListeners = new Messages(client.requests)(client)
    client.registerListener(reactionListeners.onUserReactAddRole)
    client.registerListener(reactionListeners.onUserReactRemoveRole)
    client.registerListener(messageListeners.onUserMessage)
    client.login();
  })
}