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

Latest commit

 

History

History
36 lines (28 loc) · 950 Bytes

bot-overlord.md

File metadata and controls

36 lines (28 loc) · 950 Bytes

Overlord

Overlord is an Actor that is not binded to specific conversation. Currently overlords is responsible to receiving web hooks.

Implementing

For implementing overlord, you need to subclass MagicOverlord class and implement required methods:

class ExampleOverlord(scope: MagicOverlordScope) : MagicOverlord(scope) {
    override fun onRawWebHookReceived(name: String, body: ByteArray, headers: JSONObject) {
        // Implement Hook Processing
    }
}

Registering

Also you need to register overlord class:

farm("BotFarm") {
    bot(EchoBot::class) {
        name = "echo"
        token = "<YOUR_TOKEN_HERE>"
        traceHook = "<OPTIONAL_TRACE_WEBHOOK>"
        overlord = ExampleOverlord::class
    }
}

Sending Message to Overlord

This message can be received in onReceive method of overlord. WARRING: Do not forget to call super class method.

fun sendToOverlord(object: Any)