Skip to content

Commit 64de120

Browse files
committed
update stuff
1 parent a82d00f commit 64de120

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

build.gradle.kts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
kotlin("jvm") version "1.7.21"
4+
kotlin("jvm") version "1.9.22"
55
application
6+
idea
67
}
78

8-
group = "net.developerden"
9+
group = "org.developerden"
910
version = "1.0-SNAPSHOT"
1011

12+
// use java 17
13+
java {
14+
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
15+
}
16+
1117
repositories {
1218
mavenCentral()
1319
}
1420

1521
dependencies {
16-
implementation("net.dv8tion:JDA:5.0.0-beta.2")
22+
implementation("net.dv8tion:JDA:5.0.0-beta.18")
1723
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
1824
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.4")
1925
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.6.4")
@@ -29,9 +35,10 @@ tasks.test {
2935
}
3036

3137
tasks.withType<KotlinCompile> {
32-
kotlinOptions.jvmTarget = "16"
38+
kotlinOptions.jvmTarget = "17"
3339
}
3440

41+
3542
application {
3643
mainClass.set("MainKt")
3744
}

src/main/kotlin/Main.kt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import kotlinx.coroutines.*
1+
import kotlinx.coroutines.DelicateCoroutinesApi
2+
import kotlinx.coroutines.GlobalScope
3+
import kotlinx.coroutines.async
4+
import kotlinx.coroutines.runBlocking
25
import net.dv8tion.jda.api.JDABuilder
36
import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel
47
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel
@@ -10,8 +13,8 @@ import kotlin.time.ExperimentalTime
1013

1114
private val logger = LoggerFactory.getLogger("Main")
1215

13-
@OptIn(DelicateCoroutinesApi::class)
14-
@ExperimentalTime
16+
17+
1518
fun main() {
1619
println("Enter token")
1720
val token = readln()
@@ -22,7 +25,7 @@ fun main() {
2225
jda.awaitReady()
2326

2427
val lastYear = LocalDate
25-
.of(2021, 12, 31)
28+
.of(2022, 12, 31)
2629
.atTime(23, 59, 59)
2730
.toInstant(ZoneOffset.UTC)
2831

@@ -35,6 +38,8 @@ fun main() {
3538
.toSet()
3639
logger.info("Staff: {}", staffUsers.map { it.name })
3740

41+
val index = getAllMessages(devden, lastYear)
42+
3843
val intros = async {
3944
getAllMessages(
4045
devden.getChannelById(TextChannel::class.java, 888142541592076347)!!,
@@ -50,18 +55,18 @@ fun main() {
5055
}
5156

5257
val showcaseReactions = async {
53-
val showcases = getAllMessages(
54-
devden.getChannelById(TextChannel::class.java, 847936633964724254)!!,
58+
val showcases = getThreads(
59+
devden.getChannelById(ForumChannel::class.java, 1115235973622661150)!!,
5560
lastYear
5661
)
57-
showcases.size to showcases.sumOf { it.reactions.size }
62+
showcases.size to showcases.sumOf { it.retrieveStartMessage().await().reactions.size }
5863
}
5964

6065
val starboardReactions = async {
6166
getAllMessages(
6267
devden.getChannelById(TextChannel::class.java, 975786395211816980)!!,
6368
lastYear
64-
).sumOf { it.reactions.size }
69+
).mapToInt { it.reactions.size }.sum()
6570
}
6671

6772
val notAllowedEmojis = async {
@@ -94,7 +99,7 @@ fun main() {
9499

95100
logger.info(
96101
"""
97-
Found ${intros.await().size} intros
102+
Found ${intros.await().count()} intros
98103
Found ${staffMentions.await().size} staff mentions
99104
Found ${index.size} overall messages
100105
Found ${showcaseReactions.await().second} showcase reactions across ${showcaseReactions.await().first} messages

0 commit comments

Comments
 (0)