File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
kotlin/me/ddivad/judgebot/preconditions Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ dependencies {
1616 implementation(" me.jakejmattson:DiscordKt:${Versions .DISCORDKT } " )
1717 implementation(" org.litote.kmongo:kmongo-coroutine:4.2.8" )
1818 implementation(" joda-time:joda-time:2.10.10" )
19+ implementation(" org.slf4j:slf4j-simple:1.7.30" )
1920}
2021
2122tasks {
Original file line number Diff line number Diff line change 1+ package me.ddivad.judgebot.preconditions
2+
3+ import me.jakejmattson.discordkt.api.dsl.precondition
4+ import me.jakejmattson.discordkt.api.extensions.sanitiseMentions
5+
6+ fun commandLogger () = precondition {
7+ command ? : return @precondition fail()
8+
9+ val args = rawInputs.commandArgs.joinToString()
10+
11+ if (args.length > 1500 )
12+ return @precondition fail(" Command is too long (${args.length} chars, max: 1500" )
13+
14+ if (guild != null ) {
15+ val message =
16+ " ${author.tag} :: ${author.id.value} :: " +
17+ " Invoked `${command!! .names.first()} `" +
18+ if (args.isEmpty()) " " else " Args: ${args.sanitiseMentions(discord)} "
19+
20+ println (message)
21+ return @precondition
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ org.slf4j.simpleLogger.defaultLogLevel =trace
2+ org.slf4j.simpleLogger.showDateTime =true
You can’t perform that action at this time.
0 commit comments