Synapse Dockerfile
This commit is contained in:
@@ -4,7 +4,6 @@ import io.ktor.http.*
|
||||
import io.ktor.server.engine.*
|
||||
import io.ktor.server.netty.*
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import net.folivo.trixnity.appservice.rest.DefaultAppserviceService
|
||||
import net.folivo.trixnity.appservice.rest.MatrixAppserviceProperties
|
||||
@@ -18,33 +17,25 @@ import net.folivo.trixnity.client.api.MatrixApiClient
|
||||
import net.folivo.trixnity.core.model.RoomAliasId
|
||||
import net.folivo.trixnity.core.model.RoomId
|
||||
import net.folivo.trixnity.core.model.UserId
|
||||
import net.folivo.trixnity.core.model.events.m.room.RoomMessageEventContent
|
||||
|
||||
val matrixClient = MatrixApiClient(
|
||||
baseUrl = Url("http://okupamicoche-synapse:8008/"),
|
||||
).apply { accessToken.value = "syt_dGVzdDM_OIheLExYmDBsfAeENWfF_3BwxFM" }
|
||||
//).apply { accessToken.value = "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" } // TODO Error 500
|
||||
).apply { accessToken.value = "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" }
|
||||
|
||||
suspend fun main() {
|
||||
|
||||
|
||||
coroutineScope {
|
||||
matrixClient.sync.subscribe<RoomMessageEventContent.TextMessageEventContent> { println(it.content.body) }
|
||||
|
||||
matrixClient.sync.subscribeAllEvents { // this is a shortcut for .subscribe<EventContent> { }
|
||||
// println(it)
|
||||
}
|
||||
|
||||
launch {
|
||||
matrixClient.sync.start(wait = true, scope = this) // you need to start the sync to receive messages
|
||||
}
|
||||
|
||||
val appserviceService = DefaultAppserviceService(
|
||||
EventTnxService(),
|
||||
UserService(),
|
||||
RoomService()
|
||||
)
|
||||
println(3)
|
||||
|
||||
appserviceService.subscribeAllEvents {
|
||||
event -> println(event)
|
||||
}
|
||||
|
||||
launch {
|
||||
embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
|
||||
matrixAppserviceModule(
|
||||
@@ -53,7 +44,6 @@ suspend fun main() {
|
||||
)
|
||||
}.start(wait = true)
|
||||
}
|
||||
println(4)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user