Skip to content

Commit

Permalink
Create a moderation arguments class to shrink the arguments down
Browse files Browse the repository at this point in the history
  • Loading branch information
NoComment1105 committed Apr 2, 2024
1 parent 96b3cd6 commit b82f7ef
Showing 1 changed file with 33 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -956,72 +956,20 @@ class ModerationCommands : Extension() {
}
}

inner class BanArgs : Arguments() {
/** The user to ban. */
val userArgument by user {
name = "user"
description = "Person to ban"
}

inner class BanArgs : ModerationArguments() {
/** 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 : Arguments() {
/** The user to soft-ban. */
val userArgument by user {
name = "user"
description = "Person to Soft ban"
}

inner class SoftBanArgs : ModerationArguments() {
/** 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() {
Expand All @@ -1039,66 +987,14 @@ class ModerationCommands : Extension() {
}
}

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 KickArgs : ModerationArguments()

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() {
Expand All @@ -1116,33 +1012,7 @@ class ModerationCommands : Extension() {
}
}

inner class WarnArgs : Arguments() {
/** The requested user to warn. */
val userArgument by user {
name = "user"
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. */
val dm by defaultingBoolean {
name = "dm"
description = "Whether to send a direct message to the user about the warning"
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 WarnArgs : ModerationArguments()

inner class RemoveWarnArgs : Arguments() {
/** The requested user to remove the warning from. */
Expand All @@ -1160,6 +1030,34 @@ class ModerationCommands : Extension() {
}
}

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"
}

/** 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
}

/** 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"
}
}

/**
* Creates a log for timeouts produced by a number of warnings.
*
Expand Down

0 comments on commit b82f7ef

Please sign in to comment.