Skip to content

Commit 9a83a59

Browse files
committed
feat!: change config path under config directory
1 parent 1ac6368 commit 9a83a59

File tree

1 file changed

+26
-15
lines changed
  • src/main/kotlin/net/azisaba/guildchatdiscord

1 file changed

+26
-15
lines changed

src/main/kotlin/net/azisaba/guildchatdiscord/Main.kt

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@file:JvmName("MainKt")
2+
23
package net.azisaba.guildchatdiscord
34

45
import dev.kord.core.Kord
@@ -19,17 +20,18 @@ import java.io.File
1920

2021
private val logger = LoggerFactory.getLogger("GuildChatDiscord")
2122

22-
private val commandHandlers = mutableMapOf(
23-
"link" to LinkCommand,
24-
"unlink" to UnlinkCommand,
25-
"connect" to ConnectCommand,
26-
"unconnect" to UnconnectCommand,
27-
"nickname" to NickCommand,
28-
)
23+
private val commandHandlers =
24+
mutableMapOf(
25+
"link" to LinkCommand,
26+
"unlink" to UnlinkCommand,
27+
"connect" to ConnectCommand,
28+
"unconnect" to UnconnectCommand,
29+
"nickname" to NickCommand,
30+
)
2931

3032
@OptIn(PrivilegedIntent::class)
3133
suspend fun main() {
32-
BotConfig.loadConfig(File("."))
34+
BotConfig.loadConfig(File("./config"))
3335
logger.info("Connecting to Redis")
3436
JedisBoxProvider.get()
3537
logger.info("Connecting to database")
@@ -46,9 +48,17 @@ suspend fun main() {
4648
client.on<MessageCreateEvent> {
4749
if (message.author?.isBot != false) return@on
4850
val guildId = DatabaseManager.getGuildIdByChannelId(message.channelId.value.toLong()) ?: return@on
49-
val minecraftUuid = DatabaseManager.getMinecraftUUIDByDiscordId(message.author!!.id.value.toLong()) ?: return@on
51+
val minecraftUuid =
52+
DatabaseManager.getMinecraftUUIDByDiscordId(
53+
message.author!!
54+
.id.value
55+
.toLong(),
56+
) ?: return@on
5057
// return if the author is not member of the guild
51-
InterChatDiscord.guildManager.getMember(guildId, minecraftUuid).exceptionally { null }.join() ?: return@on
58+
InterChatDiscord.guildManager
59+
.getMember(guildId, minecraftUuid)
60+
.exceptionally { null }
61+
.join() ?: return@on
5262

5363
var content = message.content
5464
if (message.attachments.isNotEmpty()) content += "\n"
@@ -68,11 +78,12 @@ suspend fun main() {
6878
}
6979

7080
client.login {
71-
intents = Intents(
72-
Intent.DirectMessages,
73-
Intent.MessageContent, // Privileged intent
74-
Intent.GuildMessages,
75-
)
81+
intents =
82+
Intents(
83+
Intent.DirectMessages,
84+
Intent.MessageContent, // Privileged intent
85+
Intent.GuildMessages,
86+
)
7687
}
7788

7889
// After logout/shutdown

0 commit comments

Comments
 (0)