Skip to content

Commit

Permalink
Log to Saddest of the Sads too
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Oct 23, 2024
1 parent 99ccd70 commit af4b5eb
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ class LoriToolsCommand(val helper: LorittaHelper) : SlashCommandDeclarationWrapp
override val options = Options()

override suspend fun executeHelper(context: ApplicationCommandContext, args: SlashCommandArguments) {
context.deferChannelMessage(false)

val clientId = UUID.fromString(args[options.clientId])

transaction(helper.databases.helperDatabase) {
Expand All @@ -719,9 +721,17 @@ class LoriToolsCommand(val helper: LorittaHelper) : SlashCommandDeclarationWrapp
}
}

LoriToolsUtils.logToSaddestOfTheSads(
helper,
context.user,
) {
this.title = "$clientId | Adicionado Client ID na Whitelist"
field("Motivo", args[options.reason], true)
}

context.reply(false) {
styled(
"Adicionado Client ID na lista de ignorar"
"Adicionado Client ID na whitelist"
)
}
}
Expand All @@ -736,6 +746,8 @@ class LoriToolsCommand(val helper: LorittaHelper) : SlashCommandDeclarationWrapp
override val options = Options()

override suspend fun executeHelper(context: ApplicationCommandContext, args: SlashCommandArguments) {
context.deferChannelMessage(false)

val clientId = UUID.fromString(args[options.clientId])

transaction(helper.databases.helperDatabase) {
Expand All @@ -744,9 +756,17 @@ class LoriToolsCommand(val helper: LorittaHelper) : SlashCommandDeclarationWrapp
}
}

LoriToolsUtils.logToSaddestOfTheSads(
helper,
context.user,
) {
this.title = "$clientId | Removido Client ID da Whitelist"
field("Motivo", args[options.reason], true)
}

context.reply(false) {
styled(
"Removido Client ID da lista de ignorar"
"Removido Client ID da whitelist"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.perfectdreams.loritta.helper.utils.slash

import dev.minn.jda.ktx.messages.InlineEmbed
import dev.minn.jda.ktx.messages.MessageCreate
import net.dv8tion.jda.api.entities.User
import net.dv8tion.jda.api.utils.TimeFormat
Expand Down Expand Up @@ -49,4 +50,22 @@ object LoriToolsUtils {
}
).await()
}

suspend fun logToSaddestOfTheSads(
helper: LorittaHelper,
moderator: User,
embed: InlineEmbed.() -> (Unit),
) {
val community = helper.config.guilds.community

val channel = helper.jda.getTextChannelById(community.channels.saddestOfTheSads) ?: return

channel.sendMessage(
MessageCreate {
embed {
author("${moderator.name}#${moderator.discriminator} (${moderator.id})", null, moderator.avatarUrl)
}
}
).await()
}
}

0 comments on commit af4b5eb

Please sign in to comment.