From 34516e074e32d65f6ec00c018181a2b1a54a2ded Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:26:54 +0100 Subject: [PATCH 1/9] make it so that delete command doenst do puke gif it ugly ewwww --- src/main/kotlin/org/openredstone/chad/commands/Command.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/openredstone/chad/commands/Command.kt b/src/main/kotlin/org/openredstone/chad/commands/Command.kt index 66926f8..a89f459 100644 --- a/src/main/kotlin/org/openredstone/chad/commands/Command.kt +++ b/src/main/kotlin/org/openredstone/chad/commands/Command.kt @@ -328,7 +328,7 @@ fun deleteCommand(authorizedRoles: List, discordApi: DiscordApi, chadCon ) setColor(Color.RED) setFooter("FootORE") - setThumbnail("https://cdn.discordapp.com/emojis/892499052942463027.webp") + // setThumbnail("https://cdn.discordapp.com/emojis/892499052942463027.webp") // no } MessageBuilder().copy(target).addEmbed(embed).send(removedContentChannel).await() target.delete().await() From 958d66dc62587b532c873af31adf799457edbe48 Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:30:38 +0100 Subject: [PATCH 2/9] make it so pikl CANNOT be reinserted --- src/main/kotlin/org/openredstone/chad/Sql.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Sql.kt b/src/main/kotlin/org/openredstone/chad/Sql.kt index a73ab4f..f2889f7 100644 --- a/src/main/kotlin/org/openredstone/chad/Sql.kt +++ b/src/main/kotlin/org/openredstone/chad/Sql.kt @@ -16,10 +16,12 @@ class Sql(file: String, driver: String = "org.sqlite.JDBC") { } fun insertCommand(key: String, response: String) = transaction(database) { - SqlCommand.deleteWhere { SqlCommand.key eq key } - SqlCommand.insert { - it[SqlCommand.key] = key - it[SqlCommand.response] = response + if (key != "pikl") { // todo check for other predefined commands + SqlCommand.deleteWhere { SqlCommand.key eq key } + SqlCommand.insert { + it[SqlCommand.key] = key + it[SqlCommand.response] = response + } } } From 5ddda4069f500b83ae4234858da88ddbdee71571 Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:52:28 +0100 Subject: [PATCH 3/9] okay mr nicky :nerd: --- src/main/kotlin/org/openredstone/chad/commands/Command.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/openredstone/chad/commands/Command.kt b/src/main/kotlin/org/openredstone/chad/commands/Command.kt index a89f459..da761c0 100644 --- a/src/main/kotlin/org/openredstone/chad/commands/Command.kt +++ b/src/main/kotlin/org/openredstone/chad/commands/Command.kt @@ -328,7 +328,7 @@ fun deleteCommand(authorizedRoles: List, discordApi: DiscordApi, chadCon ) setColor(Color.RED) setFooter("FootORE") - // setThumbnail("https://cdn.discordapp.com/emojis/892499052942463027.webp") // no + setThumbnail("https://cdn.discordapp.com/emojis/892499052942463027.webp") // big bruh momnet } MessageBuilder().copy(target).addEmbed(embed).send(removedContentChannel).await() target.delete().await() From 28baa2b51aa290afd2e4899fd1f7fc0d644d6ac4 Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:57:50 +0100 Subject: [PATCH 4/9] yeahh epic dynamic fixxx --- src/main/kotlin/org/openredstone/chad/Chad.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Chad.kt b/src/main/kotlin/org/openredstone/chad/Chad.kt index 42c8569..95129db 100644 --- a/src/main/kotlin/org/openredstone/chad/Chad.kt +++ b/src/main/kotlin/org/openredstone/chad/Chad.kt @@ -68,6 +68,7 @@ fun main(args: Array) = runBlocking { .orElseThrow { NoSuchElementException("Server not found") } val commands = concurrentMapOf() + val noTouchy = arrayOf("conv", "poll", "lmgtfy", "apply", "insult", "add", "remove", "issue", "delete", "pikl", "authorized", "reload") fun regenerateHelpCommand() { commands["help"] = helpCommand(commands) @@ -97,14 +98,18 @@ fun main(args: Array) = runBlocking { val name by required() val messages by vararg() reply { - val msg = messages.joinToString(separator = " ") - val cmd = command { - reply { msg } + if (cmd in noTouchy) { + "u no touchy my commandy" + } else { + val msg = messages.joinToString(separator = " ") + val cmd = command { + reply { msg } + } + database.insertCommand(name, msg) + commands[name] = cmd + regenerateHelpCommand() + "Done!" } - database.insertCommand(name, msg) - commands[name] = cmd - regenerateHelpCommand() - "Done!" } }) put("remove", command(authorizedRoles) { From 3436843d2d9c87ac0a2840f9fb74a181d64e2bd9 Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:58:25 +0100 Subject: [PATCH 5/9] yeah remov dat stuff --- src/main/kotlin/org/openredstone/chad/Sql.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Sql.kt b/src/main/kotlin/org/openredstone/chad/Sql.kt index f2889f7..a73ab4f 100644 --- a/src/main/kotlin/org/openredstone/chad/Sql.kt +++ b/src/main/kotlin/org/openredstone/chad/Sql.kt @@ -16,12 +16,10 @@ class Sql(file: String, driver: String = "org.sqlite.JDBC") { } fun insertCommand(key: String, response: String) = transaction(database) { - if (key != "pikl") { // todo check for other predefined commands - SqlCommand.deleteWhere { SqlCommand.key eq key } - SqlCommand.insert { - it[SqlCommand.key] = key - it[SqlCommand.response] = response - } + SqlCommand.deleteWhere { SqlCommand.key eq key } + SqlCommand.insert { + it[SqlCommand.key] = key + it[SqlCommand.response] = response } } From 4888fa4471b3b7dbf29606becc0ab8e27071918d Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 21:04:03 +0100 Subject: [PATCH 6/9] test fix?1'1 --- src/main/kotlin/org/openredstone/chad/Chad.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Chad.kt b/src/main/kotlin/org/openredstone/chad/Chad.kt index 95129db..04b6b44 100644 --- a/src/main/kotlin/org/openredstone/chad/Chad.kt +++ b/src/main/kotlin/org/openredstone/chad/Chad.kt @@ -67,8 +67,7 @@ fun main(args: Array) = runBlocking { val discordServer = discordApi.getServerById(chadConfig.serverId) .orElseThrow { NoSuchElementException("Server not found") } - val commands = concurrentMapOf() - val noTouchy = arrayOf("conv", "poll", "lmgtfy", "apply", "insult", "add", "remove", "issue", "delete", "pikl", "authorized", "reload") + val commands = concurrentMapOf() fun regenerateHelpCommand() { commands["help"] = helpCommand(commands) @@ -77,6 +76,7 @@ fun main(args: Array) = runBlocking { fun reloadCommands() { chadConfig = config[ChadSpec.chad] val authorizedRoles = chadConfig.authorizedDiscordRoles + val noTouchy = arrayOf("conv", "poll", "lmgtfy", "apply", "insult", "add", "remove", "issue", "delete", "pikl", "authorized", "reload") logger.info("(Re)loading commands...") From e1f73dee4cac761a7c3415b187224eae34a2179a Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 21:10:11 +0100 Subject: [PATCH 7/9] epic fix (its the final fix-down :music:) --- src/main/kotlin/org/openredstone/chad/Chad.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Chad.kt b/src/main/kotlin/org/openredstone/chad/Chad.kt index 04b6b44..3219f0c 100644 --- a/src/main/kotlin/org/openredstone/chad/Chad.kt +++ b/src/main/kotlin/org/openredstone/chad/Chad.kt @@ -98,13 +98,13 @@ fun main(args: Array) = runBlocking { val name by required() val messages by vararg() reply { + val cmd = command { + reply { msg } + } if (cmd in noTouchy) { "u no touchy my commandy" } else { val msg = messages.joinToString(separator = " ") - val cmd = command { - reply { msg } - } database.insertCommand(name, msg) commands[name] = cmd regenerateHelpCommand() From 3b51c6cdecc69d0e200bc10ea70eea6de4e6548f Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 21:14:29 +0100 Subject: [PATCH 8/9] watch this one work --- src/main/kotlin/org/openredstone/chad/Chad.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Chad.kt b/src/main/kotlin/org/openredstone/chad/Chad.kt index 3219f0c..7ad44ef 100644 --- a/src/main/kotlin/org/openredstone/chad/Chad.kt +++ b/src/main/kotlin/org/openredstone/chad/Chad.kt @@ -98,13 +98,14 @@ fun main(args: Array) = runBlocking { val name by required() val messages by vararg() reply { - val cmd = command { - reply { msg } - } - if (cmd in noTouchy) { + if (name in noTouchy) { "u no touchy my commandy" } else { + val cmd = command { + reply { msg } + } val msg = messages.joinToString(separator = " ") + database.insertCommand(name, msg) commands[name] = cmd regenerateHelpCommand() From dab769b9af59a97d492883f24f13f2de66507575 Mon Sep 17 00:00:00 2001 From: Tukeque <59365069+Tukeque@users.noreply.github.com> Date: Sun, 22 Jan 2023 21:18:50 +0100 Subject: [PATCH 9/9] will this work? who knows? screw nisker and oscr91 --- src/main/kotlin/org/openredstone/chad/Chad.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/openredstone/chad/Chad.kt b/src/main/kotlin/org/openredstone/chad/Chad.kt index 7ad44ef..fd2f39f 100644 --- a/src/main/kotlin/org/openredstone/chad/Chad.kt +++ b/src/main/kotlin/org/openredstone/chad/Chad.kt @@ -98,13 +98,13 @@ fun main(args: Array) = runBlocking { val name by required() val messages by vararg() reply { - if (name in noTouchy) { + if (name.toString() in noTouchy) { "u no touchy my commandy" } else { + val msg = messages.joinToString(separator = " ") val cmd = command { reply { msg } } - val msg = messages.joinToString(separator = " ") database.insertCommand(name, msg) commands[name] = cmd