Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Setting endpoint #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions actor-bots-example/src/main/java/im/actor/bots/MainBotFarm.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package im.actor.bots

import im.actor.botkit.RemoteBot
import im.actor.bots.framework.farm
import im.actor.bots.framework.traits.sharedBugSnagClient

fun main(args: Array<String>) {

// val endpoint = ""wss://api.your-actor.im""
val endpoint = RemoteBot.DefaultEndpoint()

farm("NewFarm") {

farm("NewFarm", endpoint) {

bot(EchoStatefulBot::class) {
name = "BOT_NAME_HERE"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package im.actor.bots

import im.actor.botkit.RemoteBot
import im.actor.bots.framework.farm

fun main(args: Array<String>) {
farm("bots") {

val endpoint = RemoteBot.DefaultEndpoint()

farm("bots", endpoint) {

// Stewie
// bot(WunderListDebugBot::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package im.actor.bots.framework

import akka.actor.ActorSystem
import akka.actor.Props
import im.actor.botkit.RemoteBot
import java.util.*
import kotlin.reflect.KClass

class BotFarm(val name: String) {
class BotFarm(val name: String, endpoint: String) {

var endpoint = RemoteBot.DefaultEndpoint()
var endpoint = endpoint
val system = ActorSystem.create(name)
val bots = ArrayList<BotDescription>()

Expand Down Expand Up @@ -41,8 +40,8 @@ class BotDescription(val clazz: KClass<MagicBotFork>) {
var overlordClazz: Class<*>? = null
}

public fun farm(name: String, init: BotFarm.() -> Unit) {
val res = BotFarm(name)
public fun farm(name: String, endpoint: String, init: BotFarm.() -> Unit) {
val res = BotFarm(name, endpoint)
res.init()
res.startFarm()
}