From aab071a5bee897a09473ddb9fb9043228076a652 Mon Sep 17 00:00:00 2001 From: NoComment Date: Tue, 2 Apr 2024 16:15:39 +0100 Subject: [PATCH] Revert "Create a moderation arguments class to shrink the arguments down" This reverts commit b82f7ef609b70763acab6debe893b7e05115fd4d. --- .../moderation/ModerationCommands.kt | 168 ++++++++++++++---- 1 file changed, 135 insertions(+), 33 deletions(-) diff --git a/src/main/kotlin/org/hyacinthbots/lilybot/extensions/moderation/ModerationCommands.kt b/src/main/kotlin/org/hyacinthbots/lilybot/extensions/moderation/ModerationCommands.kt index a533d5e2..7e89626a 100644 --- a/src/main/kotlin/org/hyacinthbots/lilybot/extensions/moderation/ModerationCommands.kt +++ b/src/main/kotlin/org/hyacinthbots/lilybot/extensions/moderation/ModerationCommands.kt @@ -956,20 +956,72 @@ class ModerationCommands : Extension() { } } - inner class BanArgs : ModerationArguments() { + inner class BanArgs : Arguments() { + /** The user to ban. */ + val userArgument by user { + name = "user" + description = "Person to ban" + } + /** The number of days worth of messages to delete. */ val messages by int { name = "delete-message-days" description = "The number of days worth of messages to delete" } + + /** The reason for the ban. */ + val reason by defaultingString { + name = "reason" + description = "The reason for the ban" + defaultValue = "No reason provided" + } + + /** Whether to DM the user or not. */ + val dm by defaultingBoolean { + name = "dm" + description = "Whether to send a direct message to the user about the ban" + defaultValue = true + } + + /** An image that the user wishes to provide for context to the ban. */ + val image by optionalAttachment { + name = "image" + description = "An image you'd like to provide as extra context for the action" + } } - inner class SoftBanArgs : ModerationArguments() { + inner class SoftBanArgs : Arguments() { + /** The user to soft-ban. */ + val userArgument by user { + name = "user" + description = "Person to Soft ban" + } + /** The number of days worth of messages to delete, defaults to 3 days. */ val messages by optionalInt { name = "delete-message-days" description = "The number of days worth of messages to delete" } + + /** The reason for the soft-ban. */ + val reason by defaultingString { + name = "reason" + description = "The reason for the ban" + defaultValue = "No reason provided" + } + + /** Whether to DM the user or not. */ + val dm by defaultingBoolean { + name = "dm" + description = "Whether to send a direct message to the user about the soft-ban" + defaultValue = true + } + + /** An image that the user wishes to provide for context to the soft-ban. */ + val image by optionalAttachment { + name = "image" + description = "An image you'd like to provide as extra context for the action" + } } inner class UnbanArgs : Arguments() { @@ -987,14 +1039,66 @@ class ModerationCommands : Extension() { } } - inner class KickArgs : ModerationArguments() + inner class KickArgs : Arguments() { + /** The user to kick. */ + val userArgument by user { + name = "user" + description = "Person to kick" + } + + /** The reason for the kick. */ + val reason by defaultingString { + name = "reason" + description = "The reason for the Kick" + defaultValue = "No reason provided" + } + + /** Whether to DM the user or not. */ + val dm by defaultingBoolean { + name = "dm" + description = "Whether to send a direct message to the user about the kick" + defaultValue = true + } + + /** An image that the user wishes to provide for context to the kick. */ + val image by optionalAttachment { + name = "image" + description = "An image you'd like to provide as extra context for the action" + } + } + + inner class TimeoutArgs : Arguments() { + /** The requested user to timeout. */ + val userArgument by user { + name = "user" + description = "Person to timeout" + } - inner class TimeoutArgs : ModerationArguments() { /** The time the timeout should last for. */ val duration by coalescingOptionalDuration { name = "duration" description = "Duration of timeout" } + + /** The reason for the timeout. */ + val reason by defaultingString { + name = "reason" + description = "Reason for timeout" + defaultValue = "No reason provided" + } + + /** Whether to DM the user or not. */ + val dm by defaultingBoolean { + name = "dm" + description = "Whether to send a direct message to the user about the timeout" + defaultValue = true + } + + /** An image that the user wishes to provide for context to the kick. */ + val image by optionalAttachment { + name = "image" + description = "An image you'd like to provide as extra context for the action" + } } inner class RemoveTimeoutArgs : Arguments() { @@ -1012,13 +1116,18 @@ class ModerationCommands : Extension() { } } - inner class WarnArgs : ModerationArguments() - - inner class RemoveWarnArgs : Arguments() { - /** The requested user to remove the warning from. */ + inner class WarnArgs : Arguments() { + /** The requested user to warn. */ val userArgument by user { name = "user" - description = "Person to remove warn from" + description = "Person to warn" + } + + /** The reason for the warning. */ + val reason by defaultingString { + name = "reason" + description = "Reason for warning" + defaultValue = "No reason provided" } /** Whether to DM the user or not. */ @@ -1027,34 +1136,27 @@ class ModerationCommands : Extension() { description = "Whether to send a direct message to the user about the warning" defaultValue = true } - } -} - -open class ModerationArguments : Arguments() { - /** The target user to apply the action too. */ - val userArgument by user { - name = "user" - description = "The user to apply this action too" - } - /** The reason for the action. */ - val reason by defaultingString { - name = "reason" - description = "Reason for action" - defaultValue = "No reason provided" + /** An image that the user wishes to provide for context to the kick. */ + val image by optionalAttachment { + name = "image" + description = "An image you'd like to provide as extra context for the action" + } } - /** Whether to DM the user or not. */ - val dm by defaultingBoolean { - name = "dm" - description = "Whether to send a direct message to the user about the action" - defaultValue = true - } + inner class RemoveWarnArgs : Arguments() { + /** The requested user to remove the warning from. */ + val userArgument by user { + name = "user" + description = "Person to remove warn from" + } - /** An image that the user wishes to provide for context to the action. */ - val image by optionalAttachment { - name = "image" - description = "An image you'd like to provide as extra context for the action" + /** Whether to DM the user or not. */ + val dm by defaultingBoolean { + name = "dm" + description = "Whether to send a direct message to the user about the warning" + defaultValue = true + } } }