Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
implementation("org.reflections:reflections:0.10.2")
implementation("redis.clients:jedis:7.4.1")
implementation("redis.clients:jedis:7.5.0")

runtimeOnly(kotlin("scripting-jsr223"))
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/kotlin/com/sandrabot/sandra/Sandra.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package com.sandrabot.sandra

import com.sandrabot.sandra.api.ServerController
import com.sandrabot.sandra.config.SandraConfig
import com.sandrabot.sandra.listeners.GuildListener
import com.sandrabot.sandra.listeners.InteractionListener
import com.sandrabot.sandra.listeners.MessageListener
import com.sandrabot.sandra.listeners.ReadyListener
import com.sandrabot.sandra.listeners.*
import com.sandrabot.sandra.managers.*
import com.sandrabot.sandra.services.BotListService
import dev.minn.jda.ktx.events.CoroutineEventManager
Expand Down Expand Up @@ -60,6 +57,7 @@ class Sandra(val settings: SandraConfig, val redis: RedisManager) {
addEventListeners(
GuildListener(this@Sandra),
InteractionListener(this@Sandra),
LoggingListener(this@Sandra),
MessageListener(this@Sandra),
ReadyListener(this@Sandra),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SoftBan : Command(
event.deferReply(ephemeral = isQuiet).queue()
// check the banlist to see if the target user is already banned
event.guild!!.retrieveBan(targetUser).onErrorMap { null }.await()?.let { userBan ->
val realReason = userBan.reason?.sanitize() ?: event.get("default_reason")
val realReason = userBan.reason?.sanitize() ?: event.getAny("core.phrases.no_reason")
event.replyEmoji(Emojis.BAN, event.get("already_banned", targetUser.name, realReason)).queue()
return
}
Expand Down Expand Up @@ -99,7 +99,7 @@ class SoftBan : Command(
return
}

val reason = event.arguments.text("reason") ?: event.get("default_reason")
val reason = event.arguments.text("reason") ?: event.getAny("core.phrases.no_reason")
val realReason = event.get("reason", event.user.name, reason)

var banNotification: Message? = null
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/com/sandrabot/sandra/config/ChannelConfig.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 Avery Carroll and Logan Devecka
* Copyright 2017-2026 Avery Carroll and Logan Devecka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@

package com.sandrabot.sandra.config

import com.sandrabot.sandra.constants.EventType
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -25,6 +26,9 @@ import kotlinx.serialization.Serializable
@Serializable
data class ChannelConfig(override val id: Long) : Configuration() {

@SerialName("events")
val loggingEventsEnabled = mutableSetOf<EventType>()

@SerialName("experience")
var experienceEnabled: Boolean = true
@SerialName("notify")
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/com/sandrabot/sandra/config/GuildConfig.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Avery Carroll and Logan Devecka
* Copyright 2017-2026 Avery Carroll and Logan Devecka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,6 +65,9 @@ data class GuildConfig(override val id: Long) : Configuration() {
@SerialName("last_downvote")
var lastDownvoteEmoji: String? = null

@SerialName("logging")
var loggingEnabled: Boolean = false

fun getChannel(id: Long): ChannelConfig = channels.getOrPut(id) { ChannelConfig(id) }
fun getMember(id: Long): MemberConfig = members.getOrPut(id) { MemberConfig(id) }

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/sandrabot/sandra/constants/Emojis.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ object Emojis {
const val FAILURE = "<:failure:1278461668728504380>"
const val FOLDER = "<:folder:1471993647737208934>"
const val FUN = "<:fun:1278461721349984268>"
const val IMAGE = "<:image:1472841835214012443>"
const val INFO = "<:info:1278461761858834613>"
const val INVITE = "<:invite:1471969124786901165>"
const val JOIN = "<:join:1278461800312213637>"
Expand Down
32 changes: 32 additions & 0 deletions src/main/kotlin/com/sandrabot/sandra/constants/EventType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2017-2026 Avery Carroll and Logan Devecka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.sandrabot.sandra.constants

enum class EventType(val emoji: String) {

ALL(Emojis.FOLDER),
AUTO_MOD(Emojis.MOD),
BAN(Emojis.BAN),
EMOJI(Emojis.FUN),
INVITE(Emojis.INVITE),
MEMBER(Emojis.USER),
MESSAGE(Emojis.CHAT),
POLL(Emojis.PROMPT),
SECURITY(Emojis.NOTICE),
STICKER(Emojis.IMAGE),

}
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sandrabot/sandra/constants/Unicode.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Avery Carroll and Logan Devecka
* Copyright 2017-2026 Avery Carroll and Logan Devecka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading