Skip to content

Commit

Permalink
Possible fix for /discal slowness
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaFox161 committed Mar 27, 2024
1 parent 76c4a32 commit af64c67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ class DiscalCommand(
override suspend fun suspendHandle(event: ChatInputInteractionEvent, settings: GuildSettings): Message {
val announcementCount = announcementService.getAnnouncementCount()
val calendarCount = calendarService.getCalendarCount()
val guildCount = event.client.guilds.count().awaitSingle()

val embed = embedService.discalInfoEmbed(settings, calendarCount, announcementCount)
val embed = embedService.discalInfoEmbed(settings, guildCount, calendarCount, announcementCount)

return event.followup(embed).awaitSingle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ class BotMentionListener(
val settings = event.guild.flatMap(Guild::getSettings).awaitSingle()
val announcementCount = announcementService.getAnnouncementCount()
val calendarCount = calendarService.getCalendarCount()
val guildCount = event.client.guilds.count().awaitSingle()
val channel = event.message.channel.awaitSingle()

val embed = embedService.discalInfoEmbed(settings, calendarCount, announcementCount)
val embed = embedService.discalInfoEmbed(settings, guildCount, calendarCount, announcementCount)

channel.createMessage(embed).awaitSingleOrNull()
channel.createMessage(embed)
.withMessageReference(event.message.id)
.awaitSingleOrNull()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ class EmbedService(
////////////////////////////
////// General Embeds //////
////////////////////////////
suspend fun discalInfoEmbed(settings: GuildSettings, calendarCount: Long, announcementCount: Long): EmbedCreateSpec {
val guildCount = discordClient.guilds.count().awaitSingle()

suspend fun discalInfoEmbed(settings: GuildSettings, guildCount: Long, calendarCount: Long, announcementCount: Long): EmbedCreateSpec {
return defaultEmbedBuilder(settings)
.color(GlobalVal.discalColor)
.title(getEmbedMessage("discal", "info.title", settings))
Expand Down

0 comments on commit af64c67

Please sign in to comment.