Skip to content

Commit

Permalink
Merge pull request #337 from HyacinthBots/develop
Browse files Browse the repository at this point in the history
4.7.0
  • Loading branch information
NoComment1105 committed Feb 10, 2023
2 parents c748f5d + 6367b0a commit b5e1bc7
Show file tree
Hide file tree
Showing 42 changed files with 462 additions and 715 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ body:
id: logs
attributes:
label: Relevant log output
description: If your running your own LilyBot instance, please provide some logs that generated when your issue occured. This will be automatically formatted into code, so no need for backticks.
description: If your running your own LilyBot instance, please provide some logs that generated when your issue occurred. This will be automatically formatted into code, so no need for backticks.
render: bash
- type: input
id: lily-version
Expand Down
29 changes: 12 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
application

kotlin("jvm")
kotlin("plugin.serialization")

id("com.github.johnrengelman.shadow")
id("io.gitlab.arturbosch.detekt")
id("com.github.jakemarsden.git-hooks")
id("org.ajoberstar.grgit") version "5.0.0"
id("net.kyori.blossom") version "1.3.1"
alias(libs.plugins.kotlin)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.shadow)
alias(libs.plugins.detekt)
alias(libs.plugins.git.hooks)
alias(libs.plugins.grgit)
alias(libs.plugins.blossom)
}

group = "org.hyacinthbots.lilybot"
version = "4.6.3"
version = "4.7.0"

repositories {
mavenCentral()

maven {
name = "Kotlin Discord"
url = uri("https://maven.kotlindiscord.com/repository/maven-public/")
}

maven {
name = "Sonatype Snapshots"
name = "Sonatype Snapshots (Legacy)"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}

maven {
name = "Sonatype Snapshots S01"
name = "Sonatype Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

Expand Down Expand Up @@ -91,7 +86,7 @@ tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
languageVersion = "1.7"
languageVersion = libs.plugins.kotlin.get().version.requiredVersion.substringBeforeLast(".")
incremental = true
freeCompilerArgs = listOf(
"-opt-in=kotlin.RequiresOptIn"
Expand Down
2 changes: 1 addition & 1 deletion detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ style:
UnnecessaryLet:
active: true
UnnecessaryParentheses:
active: true
active: false # Conflicts with IntelliJ
UntilInsteadOfRangeTo:
active: true
UnusedImports:
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/4.x.x/4.4.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ New:
* Added public logging to warning removal

Change:
* Rename `messages` in ban & softban commands to `delete-message-days`
* Rename `messages` in ban & soft-ban commands to `delete-message-days`
* Member counts return!

Fix:
Expand Down
20 changes: 20 additions & 0 deletions docs/changelogs/4.x.x/4.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# LilyBot 4.7.0

This update removes the deprecated support system and fixes a few bugs
You can find the full changelog below.

New:
* Log deleted messages on ban in the same style as bulk message delete
* Add targeted server announcements

Change:
* Update to Kotlin 1.8.0
* Remove deprecated support system

Fix:
* Detekt check for brackets, allowing for cleaner code
* Clean up many warnings
* Usage of `getMember()` rather than `getMemberOrNull()` leading to extra exceptions
* Update doc generator and kordex to fix some issues with errors

You can find a list of all the commits in this update [here](https://github.com/hyacinthbots/LilyBot/compare/v4.6.3...v4.7.0)
34 changes: 12 additions & 22 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ Required Member Permissions: Manage Channels
* **Arguments**:
* `channel` - The channel to view the auto-threading settings for. - Channel

---
#### Command name: `config support`
**Description**: Deprecated: Configure Lily's support system
Required Member Permissions: Manage Server

* **Arguments**:
* `enable-support` - Whether to enable the support system - Boolean
* `custom-message` - True if you'd like to add a custom message, false if you'd like the default. - Boolean
* `support-channel` - The channel to be used for creating support threads in. - Optional Channel
* `support-role` - The role to add to support threads, when one is created. - Optional Role

---
#### Command name: `config moderation`
**Description**: Configure Lily's moderation system
Expand Down Expand Up @@ -134,7 +123,7 @@ None

---
#### Command name: `github user`
**Description**: Search github for a User/Organisation
**Description**: Search GitHub for a User/Organisation

* **Arguments**:
* `username` - The name of the User/Organisation you wish to search for - String
Expand All @@ -160,7 +149,8 @@ Description: Send an announcement to all guilds Lily is in
**Required Member Permissions**: Administrator

* Arguments:
None
* `target-guild` - The guild to send the announcement too - Optional Snowflake

---
### Command name: `help`
Description: Get help with using Lily!
Expand All @@ -175,7 +165,7 @@ Description: Learn about Lily, and get uptime data!
None
---
### Command name: `invite`
Description: Get an invite link for Lily!
Description: Get an invitation link for Lily!

* Arguments:
None
Expand Down Expand Up @@ -287,7 +277,7 @@ Description: Bans a user.
* `user` - Person to ban - User
* `delete-message-days` - The number of days worth of messages to delete - Int
* `reason` - The reason for the ban - Defaulting String
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `dm` - Whether to send a direct message to the user about the ban - Defaulting Boolean
* `image` - An image you'd like to provide as extra context for the action - Optional Attachment

---
Expand All @@ -299,7 +289,7 @@ Description: Soft-bans a user.
* `user` - Person to Soft ban - User
* `delete-message-days` - The number of days worth of messages to delete - Optional Int/Long
* `reason` - The reason for the ban - Defaulting String
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `dm` - Whether to send a direct message to the user about the soft-ban - Defaulting Boolean
* `image` - An image you'd like to provide as extra context for the action - Optional Attachment

---
Expand All @@ -319,7 +309,7 @@ Description: Kicks a user.
* Arguments:
* `user` - Person to kick - User
* `reason` - The reason for the Kick - Defaulting String
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `dm` - Whether to send a direct message to the user about the kick - Defaulting Boolean
* `image` - An image you'd like to provide as extra context for the action - Optional Attachment

---
Expand All @@ -339,7 +329,7 @@ Description: Times out a user.
* `user` - Person to timeout - User
* `duration` - Duration of timeout - Coalescing Optional Duration
* `reason` - Reason for timeout - Defaulting String
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `dm` - Whether to send a direct message to the user about the timeout - Defaulting Boolean
* `image` - An image you'd like to provide as extra context for the action - Optional Attachment

---
Expand All @@ -358,8 +348,8 @@ Description: Warns a user.

* Arguments:
* `user` - Person to warn - User
* `reason` - Reason for warn - Defaulting String
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `reason` - Reason for warning - Defaulting String
* `dm` - Whether to send a direct message to the user about the warning - Defaulting Boolean
* `image` - An image you'd like to provide as extra context for the action - Optional Attachment

---
Expand All @@ -369,7 +359,7 @@ Description: Removes a user's warnings

* Arguments:
* `user` - Person to remove warn from - User
* `dm` - Whether to send a direct message to the user about the warn - Defaulting Boolean
* `dm` - Whether to send a direct message to the user about the warning - Defaulting Boolean

---
#### Command name: `news-publishing set`
Expand Down Expand Up @@ -679,7 +669,7 @@ None

---
### Command name: `command-list`
Description: Shows a list of HyacinthDev2's commands!
Description: Shows a list of LilyBot's commands!

* Arguments:
None
Expand Down
2 changes: 1 addition & 1 deletion docs/usage-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using LilyBot

This is a guide on how to **add the official instance of Lily to your sever**.
This is a guide on how to **add the official instance of Lily to your Discord sever**.
If you're looking to set up a development environment for Lily,
try our [development guide](https://github.com/HyacinthBots/LilyBot/blob/main/docs/development-guide.md).

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# suppress inspection "UnusedProperty" for whole file
# Gradle props
org.gradle.jvmargs=-Xmx1536m -XX:MaxMetaspaceSize=1536m
org.gradle.parallel=true
Expand Down
27 changes: 22 additions & 5 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
[versions]
kord-extensions = "1.5.6-20230102.101158-6"
# Plugins
kotlin = "1.8.0"
shadow = "7.1.2"
detekt = "1.22.0"
git-hooks = "0.0.2"
grgit = "5.0.0"
blossom = "1.3.1"

# Libraries
kord-extensions = "1.5.6-20230208.121744-1"
logging = "3.0.4"
logback = "1.4.5"
github-api = "1.313"
kmongo = "4.8.0"
detekt = "1.22.0"
cozy-welcome = "1.0-SNAPSHOT"
dma = "main-SNAPSHOT"
docgenerator = "0.1.1"
dma = "v0.2.0"
docgenerator = "0.1.2"

[libraries]
kord-extensions-core = { module = "com.kotlindiscord.kord.extensions:kord-extensions", version.ref = "kord-extensions" }
kord-extensions-phishing = { module = "com.kotlindiscord.kord.extensions:extra-phishing", version.ref = "kord-extensions" }
kord-extensions-pluralkit = { module = "com.kotlindiscord.kord.extensions:extra-pluralkit", version.ref = "kord-extensions"}
kord-extensions-unsafe = { module = "com.kotlindiscord.kord.extensions:unsafe", version.ref = "kord-extensions"}
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
logging = { module = "io.github.microutils:kotlin-logging", version.ref = "logging" }
github-api = { module = "org.kohsuke:github-api", version.ref = "github-api" }
Expand All @@ -23,3 +31,12 @@ detekt = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref
cozy-welcome = {module = "org.quiltmc.community:module-welcome", version.ref = "cozy-welcome"}
dma = { module = "org.hyacinthbots:discord-moderation-actions", version.ref = "dma"}
docgenerator = { module = "org.hyacinthbots:doc-generator", version.ref = "docgenerator" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
git-hooks = { id = "com.github.jakemarsden.git-hooks", version.ref = "git-hooks" }
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
18 changes: 1 addition & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
pluginManagement {
plugins {
val kotlinVersion = "1.7.21"
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion

id("com.github.johnrengelman.shadow") version "7.1.2"

id("io.gitlab.arturbosch.detekt") version "1.22.0"

id("com.github.jakemarsden.git-hooks") version "0.0.2"
}
repositories {
gradlePluginPortal()
}
}

rootProject.name = "LilyBot"

dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
versionCatalogs {
create("libs") {
from(files("libs.versions.toml"))
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/org/hyacinthbots/lilybot/LilyBot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ suspend fun main() {
filePath = docFile
environment = ENVIRONMENT
useBuiltinCommandList = true
botName = "LilyBot"
}

// Connect to GitHub to allow the GitHub commands to function
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/org/hyacinthbots/lilybot/database/Cleanups.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import org.hyacinthbots.lilybot.database.collections.ModerationConfigCollection
import org.hyacinthbots.lilybot.database.collections.NewsChannelPublishingCollection
import org.hyacinthbots.lilybot.database.collections.ReminderCollection
import org.hyacinthbots.lilybot.database.collections.RoleMenuCollection
import org.hyacinthbots.lilybot.database.collections.SupportConfigCollection
import org.hyacinthbots.lilybot.database.collections.TagsCollection
import org.hyacinthbots.lilybot.database.collections.ThreadsCollection
import org.hyacinthbots.lilybot.database.collections.UtilityConfigCollection
Expand Down Expand Up @@ -71,7 +70,6 @@ object Cleanups : KordExKoinComponent {
NewsChannelPublishingCollection().clearAutoPublishingForGuild(it.guildId)
ReminderCollection().removeGuildReminders(it.guildId)
RoleMenuCollection().removeAllRoleMenus(it.guildId)
SupportConfigCollection().clearConfig(it.guildId)
TagsCollection().clearTags(it.guildId)
ThreadsCollection().removeGuildThreads(it.guildId)
UtilityConfigCollection().clearConfig(it.guildId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@file:Suppress("DEPRECATION_ERROR")

package org.hyacinthbots.lilybot.database.collections

import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent
import dev.kord.common.entity.Snowflake
import org.hyacinthbots.lilybot.database.Database
import org.hyacinthbots.lilybot.database.entities.LoggingConfigData
import org.hyacinthbots.lilybot.database.entities.ModerationConfigData
import org.hyacinthbots.lilybot.database.entities.SupportConfigData
import org.hyacinthbots.lilybot.database.entities.UtilityConfigData
import org.koin.core.component.inject
import org.litote.kmongo.eq
Expand Down Expand Up @@ -110,60 +107,6 @@ class ModerationConfigCollection : KordExKoinComponent {
collection.deleteOne(ModerationConfigData::guildId eq inputGuildId)
}

/**
* This class contains the functions for interacting with the [Support Config Database][SupportConfigData]. This class
* contains functions for getting, setting and removing support config.
*
* @since 4.0.0
* @see getConfig
* @see setConfig
* @see clearConfig
*/
@Deprecated(
"Replaced with auto threading collection",
ReplaceWith("AutoThreadingCollection", "org.hyacinthbots.database.collections.AutoThreadingCollection"),
DeprecationLevel.WARNING
)
class SupportConfigCollection : KordExKoinComponent {
private val configDb: Database by inject()

@PublishedApi
internal val collection = configDb.configDatabase.getCollection<SupportConfigData>()

/**
* Gets the support config for the given guild using the [guildId][inputGuildId].
*
* @param inputGuildId The guild id to get the config for.
* @return The support config for the given guild.
* @author NoComment1105
* @since 4.0.0
*/
suspend inline fun getConfig(inputGuildId: Snowflake): SupportConfigData? =
collection.findOne(SupportConfigData::guildId eq inputGuildId)

/**
* Adds the given [supportConfig] to the database.
*
* @param supportConfig The new config values for the support config you want to set.
* @author Miss Corruption
* @since 4.0.0
*/
suspend inline fun setConfig(supportConfig: SupportConfigData) {
collection.deleteOne(SupportConfigData::guildId eq supportConfig.guildId)
collection.insertOne(supportConfig)
}

/**
* Clears the support config for the given guild using the [guildId][inputGuildId].
*
* @param inputGuildId The guild id to clear the config for.
* @author NoComment1105
* @since 4.0.0
*/
suspend inline fun clearConfig(inputGuildId: Snowflake) =
collection.deleteOne(SupportConfigData::guildId eq inputGuildId)
}

/**
* This class contains the functions for interacting with the [Utility Config Database][UtilityConfigData].
* This class contains functions for getting, setting and removing Utility config.
Expand Down
Loading

0 comments on commit b5e1bc7

Please sign in to comment.