All Downloads are FREE. Search and download functionalities are using the official Maven repository.

im.actor.server.cli.BotsCliService.scala Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package im.actor.server.cli

import akka.actor.{ Props, Actor, ActorLogging }
import akka.cluster.client.ClusterClientReceptionist
import akka.pattern.pipe
import im.actor.server.bot.BotExtension

object BotsCliService {
  def props = Props(new BotsCliService)
}

private final class BotsCliService extends Actor with ActorLogging {
  import context.dispatcher

  ClusterClientReceptionist(context.system).registerService(self)

  private val botExt = BotExtension(context.system)

  def receive = {
    case CreateBot(username, name, isAdmin) ⇒
      (for {
        (token, _) ← botExt.create(username, name, isAdmin)
      } yield CreateBotResponse(token)) pipeTo sender()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy