22 lines
568 B
Kotlin
22 lines
568 B
Kotlin
import dev.kord.core.Kord
|
|
import kotlinx.coroutines.CoroutineScope
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.launch
|
|
|
|
object Discord {
|
|
|
|
private lateinit var kord: Kord
|
|
suspend fun init(token: String) {
|
|
|
|
kord = Kord(token)
|
|
CoroutineScope(Dispatchers.IO).launch {
|
|
kord.login()
|
|
}
|
|
}
|
|
|
|
suspend fun sendMessage(message: String) {
|
|
kord.rest.channel.createMessage(Settings.instance.discordChannelId) {
|
|
this.content = "<@&${Settings.instance.discordGroupId}>$message"
|
|
}
|
|
}
|
|
} |