Cancelling the event listener job inside the event listener

Is it possible to cancel the Job returned by Kord#on inside its scope? I doubt it, but would something like this do the trick:
var job: Job? = null
job = kord.on<Event> {
job?.cancel()
}
var job: Job? = null
job = kord.on<Event> {
job?.cancel()
}
2 Replies
gdude
gdude5mo ago
I don't see why not?
LustigerLurch
LustigerLurch5mo ago
concurrency issues aside, yes
Want results from more Discord servers?
Add your server