mirror of
https://github.com/HMCore/Orbot.git
synced 2025-12-10 21:06:18 +00:00
add fat jar compile mode
This commit is contained in:
37
src/main/kotlin/de/wulkanat/Main.kt
Normal file
37
src/main/kotlin/de/wulkanat/Main.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package de.wulkanat
|
||||
|
||||
import net.dv8tion.jda.api.JDABuilder
|
||||
import net.dv8tion.jda.api.entities.Activity
|
||||
import net.dv8tion.jda.api.requests.GatewayIntent
|
||||
import de.wulkanat.web.SiteWatcher
|
||||
import kotlin.concurrent.timer
|
||||
|
||||
fun main() {
|
||||
// TODO: move toke into file
|
||||
val builder = JDABuilder.createLight(
|
||||
Admin.token,
|
||||
GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
||||
.addEventListeners(Bot())
|
||||
.setActivity(Activity.watching("for new Blogposts"))
|
||||
.build()
|
||||
|
||||
builder.addEventListener(Cli())
|
||||
builder.awaitReady()
|
||||
|
||||
Channels.jda = builder
|
||||
Admin.jda = builder
|
||||
Admin.ready()
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(object : Thread() {
|
||||
override fun run() {
|
||||
println("Shutting down...")
|
||||
Admin.printlnBlocking("Shutting down")
|
||||
}
|
||||
})
|
||||
|
||||
timer("Updater", daemon = true, initialDelay = 0L, period = Admin.updateMs) {
|
||||
if (SiteWatcher.hasNewBlogPost()) {
|
||||
Channels.sentToAll(SiteWatcher.newestBlog!!.toMessageEmbed())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user