1- import kotlinx.coroutines.*
1+ import kotlinx.coroutines.DelicateCoroutinesApi
2+ import kotlinx.coroutines.GlobalScope
3+ import kotlinx.coroutines.async
4+ import kotlinx.coroutines.runBlocking
25import net.dv8tion.jda.api.JDABuilder
36import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel
47import net.dv8tion.jda.api.entities.channel.concrete.TextChannel
@@ -10,8 +13,8 @@ import kotlin.time.ExperimentalTime
1013
1114private val logger = LoggerFactory .getLogger(" Main" )
1215
13- @OptIn( DelicateCoroutinesApi :: class )
14- @ExperimentalTime
16+
17+
1518fun 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