filwiesner / TmiK

Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat
MIT License
8 stars 1 forks source link

Reconnect plugin in Kotlin/JS throws Exception #1

Closed filwiesner closed 5 years ago

filwiesner commented 5 years ago

TmiK version:

0.0.5

Description:

Empty project with Reconnect plugin throws ReferenceError

Steps to reproduce:

1) Create Kotlin/Js project with Node 2) In main setup MainScope and add Reconnectplugin

tmi("oauth:token") {
  + Reconnect(10)
}

Stack trace:

ReferenceError: filterMessage$lambda is not defined
    at Coroutine$onTwitchMessage$lambda.doResume (C:\Users\Filip\Documents\wooodenbot-old\build\node_modules_imported\TmiK\TmiK.js:20405:29)
    at Coroutine$onTwitchMessage$lambda.CoroutineImpl.resumeWith_tl1gpc$ (C:\Users\Filip\Documents\wooodenbot-old\build\node_modules_imported\kotlin\kotlin.js:27964:35)
    at DispatchedContinuation.DispatchedTask.run (C:\Users\Filip\Documents\wooodenbot-old\build\node_modules_imported\kotlinx-coroutines-core\kotlinx-coroutines-core.js:2784:22)
    at NodeJsMessageQueue.MessageQueue.process (C:\Users\Filip\Documents\wooodenbot-old\build\node_modules_imported\kotlinx-coroutines-core\kotlinx-coroutines-core.js:30922:15)
    at C:\Users\Filip\Documents\wooodenbot-old\build\node_modules_imported\kotlinx-coroutines-core\kotlinx-coroutines-core.js:30873:27
    at process._tickCallback (internal/process/next_tick.js:61:11)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
filwiesner commented 5 years ago

Probably has something to do with importing because if I declare the same funtion (Reconnect()) in the same file as tmi(), it works 😕

filwiesner commented 5 years ago

Seems to be fixed by not using onTwitchMessage function. Maybe it has something to do with the function being inline and reified.
Fixed in 0.0.6