Skip to content

Commit

Permalink
Merge pull request #143 from IrisShaders/develop
Browse files Browse the repository at this point in the history
3.2.1 release
  • Loading branch information
NoComment1105 authored May 21, 2022
2 parents db6bff2 + 00c0535 commit c56d794
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 79 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = "net.irisshaders.lilybot"
version = "3.2.0"
version = "3.2.1"

repositories {
mavenCentral()
Expand Down
15 changes: 15 additions & 0 deletions docs/changelogs/3.2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# LilyBot 3.2.1 Changelog

This is a minor update with tweaks based on feedback from Lily going public.
The full changelog can be found below.

* Changes to the config are more verbose
* Images can be included as a reason for any moderation action
* The `tag-help` command displays correct information
* Errors in GitHub commands are caught correctly
* Public responses for invalid inputs have been adjusted to be more consistent
* We named our different loggers, if you're hosting or developing you might find this helpful
* Dependencies were updated

You can find a list of all the commits in this update
[here](https://github.com/IrisShaders/LilyBot/compare/v3.2.0...v3.2.1).
5 changes: 5 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Name: `kick`
Arguments:
* `kickUser` – Person to kick - User
* `reason` - Reason for the Kick - Optional String
* `image` - The URL to an image to provide extra context for the action - Optional String

Result: Kicks `kickUser` from the server with reason `reason`.

Expand All @@ -65,6 +66,7 @@ Arguments:
* `banUser` – Person to ban - User
* `messages` - Number of days of messages to delete - Integer
* `reason` - Reason for the ban - Optional String
* `image` - The URL to an image to provide extra context for the action - Optional String

Result: Bans `banUser` from the server with reason `reason` and deletes any messages they sent in the last
`messages` day(s).
Expand All @@ -84,6 +86,7 @@ Arguments:
* `softBanUser` - Person to soft ban - User
* `messages` - Number of days of messages to delete - Integer (default 3)
* `reason` - Reason for the ban - Optional String
* `image` - The URL to an image to provide extra context for the action - Optional String

Result: Bans `softBanUser`, deletes the last `messages` days of messages from them, and unbans them.

Expand All @@ -93,6 +96,7 @@ Name: `warn`
Arguments:
* `warnUser` - Person to warn - User
* `reason` - Reason for warn - Optional String
* `image` - The URL to an image to provide extra context for the action - Optional String

Result: Warns `warnUser` with a DM and adds a strike to their points total.
Depending on their new points total, action is taken based on the below table.
Expand All @@ -112,6 +116,7 @@ Arguments:
* `timeoutUser` - Person to timeout - User
* `duration` - Duration of timeout - Duration [e.g. 6h or 30s] (default 6h)
* `reason` - Reason for timeout - Optional String
* `image` - The URL to an image to provide extra context for the action - Optional String

Result: Times `timeoutUser` out for `duration`. A timeout is Discord's built-in mute function.

Expand Down
14 changes: 14 additions & 0 deletions docs/release-checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# LilyBot Release Checklist
This is a list of everything that needs to happen to release a new version of LilyBot.

* Merge all outstanding pull requests planned to be included in the release
* Create changelog in `docs/changelogs`
* Bump version
* Draft GitHub release containing the full changelog
* Draft Discord announcement containing notes and a trimmed changelog
* Create a release pull request and go through release staging FCP
* Merge the release PR without squashing
* Wait for build and deploy
* Publish release on GitHub
* Announce on Discord
* Clean up issues, specifically remove the `fixed in next release` tag
4 changes: 2 additions & 2 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
kotlin = "1.6.10" # Note: Plugin versions must be updated in the settings.gradle.kts too

groovy = "3.0.9"
kord-extensions = "1.5.3-20220505.185229-7"
kord-extensions = "1.5.4-20220520.190845-1"
logging = "2.1.21"
logback = "1.2.8"
github-api = "1.306"
kmongo = "4.5.1"
kmongo = "4.6.0"
detekt = "1.20.0"

[libraries]
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/net/irisshaders/lilybot/LilyBot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import org.litote.kmongo.reactivestreams.KMongo
import java.io.IOException

var github: GitHub? = null
private val gitHubLogger = KotlinLogging.logger { }
private val gitHubLogger = KotlinLogging.logger("GitHub Logger")

// Connect to the database using the provided connection URL
private val settings = MongoClientSettings
Expand Down
37 changes: 27 additions & 10 deletions src/main/kotlin/net/irisshaders/lilybot/extensions/config/Config.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.irisshaders.lilybot.extensions.config

import com.kotlindiscord.kord.extensions.DISCORD_BLACK
import com.kotlindiscord.kord.extensions.checks.anyGuild
import com.kotlindiscord.kord.extensions.checks.hasPermission
import com.kotlindiscord.kord.extensions.commands.Arguments
Expand All @@ -13,6 +14,8 @@ import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.entity.Permission
import dev.kord.core.behavior.channel.GuildMessageChannelBehavior
import dev.kord.core.behavior.channel.createEmbed
import kotlinx.datetime.Clock
import net.irisshaders.lilybot.utils.ConfigData
import net.irisshaders.lilybot.utils.DatabaseHelper
import net.irisshaders.lilybot.utils.responseEmbedInChannel
Expand Down Expand Up @@ -41,7 +44,7 @@ class Config : Extension() {
description = "Set the config"

check { anyGuild() }
check { hasPermission(Permission.Administrator) }
check { hasPermission(Permission.ManageGuild) }

action {
// If an action log ID doesn't exist, set the config
Expand All @@ -67,13 +70,27 @@ class Config : Extension() {

// Log the config being set in the action log
val actionLogChannel = guild?.getChannel(arguments.modActionLog.id) as GuildMessageChannelBehavior
responseEmbedInChannel(
actionLogChannel,
"Configuration set!",
"An administrator has set a config for this guild!",
null,
user.asUser()
)
actionLogChannel.createEmbed {
title = "Configuration set!"
description = "A guild manager has set a config for this guild!"
color = DISCORD_BLACK
timestamp = Clock.System.now()
field {
name = "Set values:"
value = """
Moderators Ping = ${arguments.moderatorPing.mention}
Mod Action Log = ${arguments.modActionLog.mention}
Message Logs = ${arguments.messageLogs.mention}
Join Channel = ${arguments.joinChannel.mention}
Support Team = ${arguments.supportTeam?.mention ?: "null"}
Support Channel = ${arguments.supportChannel?.mention ?: "null"}
""".trimIndent()
}
footer {
text = user.asUser().tag
icon = user.asUser().avatar?.url
}
}
}
}

Expand All @@ -82,7 +99,7 @@ class Config : Extension() {
description = "Clear the config!"

check { anyGuild() }
check { hasPermission(Permission.Administrator) }
check { hasPermission(Permission.ManageGuild) }

action {
// If an action log ID resists, inform the user their config isn't set.
Expand All @@ -98,7 +115,7 @@ class Config : Extension() {
responseEmbedInChannel(
actionLogChannel,
"Configuration cleared!",
"An administrator has cleared the configuration for this guild!",
"A Guild Manager has cleared the configuration for this guild!",
null,
user.asUser()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.coalescingDefa
import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingString
import com.kotlindiscord.kord.extensions.commands.converters.impl.int
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalChannel
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString
import com.kotlindiscord.kord.extensions.commands.converters.impl.user
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
Expand All @@ -23,12 +24,14 @@ import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.channel.GuildMessageChannelBehavior
import dev.kord.core.behavior.channel.asChannelOf
import dev.kord.core.behavior.channel.createEmbed
import dev.kord.core.behavior.channel.createMessage
import dev.kord.core.behavior.channel.editRolePermission
import dev.kord.core.behavior.edit
import dev.kord.core.entity.Message
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.thread.TextChannelThread
import dev.kord.core.supplier.EntitySupplyStrategy
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kord.rest.request.KtorRequestException
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.toList
Expand Down Expand Up @@ -211,18 +214,24 @@ class TemporaryModeration : Extension() {
}
}

actionLog.createEmbed {
title = "Warning"
color = DISCORD_BLACK
timestamp = Clock.System.now()
val embed = EmbedBuilder()
embed.color = DISCORD_BLACK
embed.title = "Warning"
embed.image = arguments.image
embed.baseModerationEmbed(arguments.reason, userArg, user)
embed.dmNotificationStatusEmbedField(dm)
embed.timestamp = Clock.System.now()
embed.field {
name = "Total Strikes:"
value = newStrikes.toString()
inline = false
}

baseModerationEmbed(arguments.reason, userArg, user)
field {
name = "Total Strikes:"
value = newStrikes.toString()
inline = false
}
dmNotificationStatusEmbedField(dm)
try {
actionLog.createMessage { embeds.add(embed) }
} catch (e: KtorRequestException) {
embed.image = null
actionLog.createMessage { embeds.add(embed) }
}
}
}
Expand Down Expand Up @@ -335,19 +344,25 @@ class TemporaryModeration : Extension() {
content = "Timed out ${userArg.id}"
}

actionLog.createEmbed {
title = "Timeout"
color = DISCORD_BLACK
timestamp = Clock.System.now()
val embed = EmbedBuilder()
embed.color = DISCORD_BLACK
embed.title = "Timeout"
embed.image = arguments.image
embed.baseModerationEmbed(arguments.reason, userArg, user)
embed.dmNotificationStatusEmbedField(dm)
embed.timestamp = Clock.System.now()
embed.field {
name = "Duration:"
value = duration.toDiscord(TimestampType.Default) + " (" + arguments.duration.toString()
.replace("PT", "") + ")"
inline = false
}

baseModerationEmbed(arguments.reason, userArg, user)
field {
name = "Duration:"
value = duration.toDiscord(TimestampType.Default) + " (" + arguments.duration.toString()
.replace("PT", "") + ")"
inline = false
}
dmNotificationStatusEmbedField(dm)
try {
actionLog.createMessage { embeds.add(embed) }
} catch (e: KtorRequestException) {
embed.image = null
actionLog.createMessage { embeds.add(embed) }
}
}
}
Expand Down Expand Up @@ -643,6 +658,12 @@ class TemporaryModeration : Extension() {
description = "Reason for timeout"
defaultValue = "No reason provided"
}

/** An image that the user wishes to provide for context to the kick. */
val image by optionalString {
name = "image"
description = "The URL to an image you'd like to provide as extra context for the action"
}
}

inner class RemoveTimeoutArgs : Arguments() {
Expand All @@ -666,6 +687,12 @@ class TemporaryModeration : Extension() {
description = "Reason for warn"
defaultValue = "No reason provided"
}

/** An image that the user wishes to provide for context to the kick. */
val image by optionalString {
name = "image"
description = "The URL to an image you'd like to provide as extra context for the action"
}
}

inner class RemoveWarnArgs : Arguments() {
Expand Down
Loading

0 comments on commit c56d794

Please sign in to comment.