Skip to content

Commit

Permalink
Merge pull request #345 from HyacinthBots/develop
Browse files Browse the repository at this point in the history
4.8.5
  • Loading branch information
NoComment1105 authored May 1, 2023
2 parents 6bcfbe0 + 00e3231 commit efe5e49
Show file tree
Hide file tree
Showing 31 changed files with 303 additions and 201 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

group = "org.hyacinthbots.lilybot"
version = "4.8.4"
version = "4.8.5"

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

This update fixes a bug and deprecate log uploading.
You can find the full changelog below

New:
* Tags can now be 4096 characters long, quite why you'd want a tag that's 4kB long I don't know, but you can do that now
* Lily will send a message in a gallery channel when permissions are broken for her

Change:
* Role menu buttons are now GuildButtons
* Upgradle to 8.1.1
* The role mention check now takes into account the `Mention @everyone, @here and All Roles` permission

Fix:
* Old tags are no longer deleted before the new tag is validated fixing wierd issues in editing
* Hopefully stop reminder randomly disappearing and subsequently multi-pinging as we're properly checking reminders before deleting them now

You can find a list of all the commits in this update [here](https://github.com/hyacinthbots/LilyBot/compare/v4.8.4...v4.8.5)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# suppress inspection "UnusedProperty" for whole file
# Gradle props
org.gradle.jvmargs=-Xmx1536m -XX:MaxMetaspaceSize=1536m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=2048m
org.gradle.parallel=true
kotlin.incremental=true
kotlin.code.style=official
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 4 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
10 changes: 5 additions & 5 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[versions]
# Plugins
kotlin = "1.8.10"
kotlin = "1.8.21"
shadow = "8.1.1"
detekt = "1.22.0"
git-hooks = "0.0.2"
grgit = "5.0.0"
grgit = "5.2.0"
blossom = "1.3.1"

# Libraries
kord-extensions = "1.5.7-20230325.173116-4"
kord-extensions = "1.5.7-20230430.120015-9"
logging = "3.0.5"
logback = "1.4.6"
logback = "1.4.7"
github-api = "1.314"
kmongo = "4.8.0"
kmongo = "4.9.0"
cozy-welcome = "1.0.1-SNAPSHOT"
dma = "0.2.0-SNAPSHOT"
docgenerator = "0.1.2-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ class ReminderCollection : KordExKoinComponent {
/**
* Removes a reminder from the database.
*
* @param userId The ID of the user the reminder belongs too
* @param number The reminder to remove
* @author NoComment1105
* @since 4.2.0
*/
suspend fun removeReminder(number: Long) = collection.deleteOne(ReminderData::id eq number)
suspend fun removeReminder(userId: Snowflake, number: Long) =
collection.deleteOne(ReminderData::userId eq userId, ReminderData::id eq number)

/**
* Removes all the reminders for a given guild.
Expand All @@ -98,10 +100,7 @@ class ReminderCollection : KordExKoinComponent {
* @since 4.5.0
*/
suspend fun repeatReminder(originalData: ReminderData, repeatingInterval: DateTimePeriod) {
collection.deleteOne(
ReminderData::id eq originalData.id,
ReminderData::userId eq originalData.userId
)
removeReminder(originalData.userId, originalData.id)

collection.insertOne(
ReminderData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Config : Extension() {
return@action
}

if (!canPingRole(arguments.moderatorRole) && arguments.moderatorRole != null) {
if (!canPingRole(arguments.moderatorRole, guild!!.id, this@ephemeralSubCommand.kord)) {
respond {
content =
"I cannot use the role: ${arguments.moderatorRole!!.mention}, because it is not mentionable by " +
Expand Down Expand Up @@ -332,7 +332,7 @@ class Config : Extension() {

footer {
text = "Configured by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}

Expand Down Expand Up @@ -453,7 +453,7 @@ class Config : Extension() {

footer {
text = "Configured by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}

Expand Down Expand Up @@ -508,7 +508,7 @@ class Config : Extension() {
}"
footer {
text = "Config cleared by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand All @@ -531,7 +531,7 @@ class Config : Extension() {
title = "Config cleared: Moderation"
footer {
text = "Config cleared by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand All @@ -553,7 +553,7 @@ class Config : Extension() {
title = "Config cleared: Logging"
footer {
text = "Config cleared by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand All @@ -575,7 +575,7 @@ class Config : Extension() {
title = "Config cleared: Utility"
footer {
text = "Config cleared by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand All @@ -590,7 +590,7 @@ class Config : Extension() {
title = "All configs cleared"
footer {
text = "Configs cleared by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import org.hyacinthbots.lilybot.database.collections.ThreadsCollection
import org.hyacinthbots.lilybot.database.entities.AutoThreadingData
import org.hyacinthbots.lilybot.extensions.config.ConfigOptions
import org.hyacinthbots.lilybot.utils.botHasChannelPerms
import org.hyacinthbots.lilybot.utils.canPingRole
import org.hyacinthbots.lilybot.utils.getLoggingChannelWithPerms

class AutoThreading : Extension() {
Expand Down Expand Up @@ -90,7 +91,7 @@ class AutoThreading : Extension() {
}

// Check if the role can be pinged
if (arguments.role?.mentionable == false) {
if (canPingRole(arguments.role, guild!!.id, this@unsafeSubCommand.kord)) {
ackEphemeral()
respondEphemeral {
content = "Lily cannot mention this role. Please fix the role's permissions and try again."
Expand Down Expand Up @@ -183,7 +184,7 @@ class AutoThreading : Extension() {
}
footer {
text = user.asUser().tag
icon = user.asUser().avatar?.url
icon = user.asUser().avatar?.cdnUrl?.toUrl()
}
timestamp = Clock.System.now()
color = DISCORD_BLACK
Expand Down Expand Up @@ -235,7 +236,7 @@ class AutoThreading : Extension() {
}
footer {
text = user.asUser().tag
icon = user.asUser().avatar?.url
icon = user.asUser().avatar?.cdnUrl?.toUrl()
}
timestamp = Clock.System.now()
color = DISCORD_BLACK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ class LogUploading : Extension() {
val thread =
event.getGuildOrNull()?.getChannelOfOrNull<TextChannelThread>(it.threadId) ?: return@forEach
if (thread.parentId == autoThreadingConfig?.channelId) {
uploadChannel =
event.getGuildOrNull()?.getChannelOfOrNull<GuildMessageChannel>(it.threadId)
?: return@forEach
try {
uploadChannel =
event.getGuildOrNull()?.getChannelOfOrNull<GuildMessageChannel>(it.threadId)
?: return@forEach
} catch (_: IllegalArgumentException) {
return@forEach
}
return@forEach
}
}
Expand Down Expand Up @@ -162,7 +166,7 @@ class LogUploading : Extension() {
"(i.e. log or crash report) if the issue persists.\n\n$DEPRECATION_MESSAGE"
footer {
text = eventMessage.author?.tag ?: ""
icon = eventMessage.author?.avatar?.url
icon = eventMessage.author?.avatar?.cdnUrl?.toUrl()
}
color = DISCORD_PINK
}
Expand All @@ -181,7 +185,7 @@ class LogUploading : Extension() {
text =
"Uploaded by ${eventMessage.author?.tag ?: eventMember?.asUserOrNull()?.tag}"
icon =
eventMessage.author?.avatar?.url ?: eventMember?.asUserOrNull()?.avatar?.url
eventMessage.author?.avatar?.cdnUrl?.toUrl() ?: eventMember?.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
color = DISCORD_PINK
}
Expand All @@ -202,8 +206,8 @@ class LogUploading : Extension() {
footer {
text =
"Uploaded by ${eventMessage.author?.tag ?: eventMember.asUserOrNull()?.tag}"
icon = eventMessage.author?.avatar?.url
?: eventMember.asUserOrNull()?.avatar?.url
icon = eventMessage.author?.avatar?.cdnUrl?.toUrl()
?: eventMember.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
timestamp = Clock.System.now()
color = DISCORD_PINK
Expand All @@ -219,8 +223,8 @@ class LogUploading : Extension() {
footer {
text =
"Uploaded by ${eventMessage.author?.tag ?: eventMember.asUserOrNull()?.tag}"
icon = eventMessage.author?.avatar?.url
?: eventMember.asUserOrNull()?.avatar?.url
icon = eventMessage.author?.avatar?.cdnUrl?.toUrl()
?: eventMember.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
timestamp = Clock.System.now()
color = DISCORD_PINK
Expand All @@ -242,8 +246,8 @@ class LogUploading : Extension() {
footer {
text =
"Uploaded by ${eventMessage.author?.tag ?: eventMember.asUserOrNull()?.tag}"
icon = eventMessage.author?.avatar?.url
?: eventMember.asUserOrNull()?.avatar?.url
icon = eventMessage.author?.avatar?.cdnUrl?.toUrl()
?: eventMember.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
timestamp = Clock.System.now()
color = DISCORD_RED
Expand Down Expand Up @@ -323,7 +327,7 @@ class LogUploading : Extension() {
color = DISCORD_RED
footer {
text = "Disabled by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand Down Expand Up @@ -364,7 +368,7 @@ class LogUploading : Extension() {
color = DISCORD_GREEN
footer {
text = "Enabled by ${user.asUserOrNull()?.tag}"
icon = user.asUserOrNull()?.avatar?.url
icon = user.asUserOrNull()?.avatar?.cdnUrl?.toUrl()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MemberLogging : Extension() {
memberLog?.createEmbed {
author {
name = "User joined the server!"
icon = event.member.avatar?.url
icon = event.member.avatar?.cdnUrl?.toUrl()
}
field {
name = "Welcome:"
Expand Down Expand Up @@ -77,7 +77,7 @@ class MemberLogging : Extension() {
embed {
author {
name = "Welcome ${event.member.username}"
icon = event.member.avatar?.url
icon = event.member.avatar?.cdnUrl?.toUrl()
}
description = if (config.publicMemberLogData?.joinMessage != null) {
config.publicMemberLogData.joinMessage
Expand Down Expand Up @@ -110,7 +110,7 @@ class MemberLogging : Extension() {
memberLog?.createEmbed {
author {
name = "User left the server!"
icon = event.user.avatar?.url
icon = event.user.avatar?.cdnUrl?.toUrl()
}
field {
name = "Goodbye:"
Expand Down Expand Up @@ -138,7 +138,7 @@ class MemberLogging : Extension() {
publicLog?.createEmbed {
author {
name = "Goodbye ${event.user.username}"
icon = event.user.avatar?.url
icon = event.user.avatar?.cdnUrl?.toUrl()
}
description = if (config.publicMemberLogData?.leaveMessage != null) {
config.publicMemberLogData.leaveMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class MessageDelete : Extension() {
}
}

@Suppress("RemoveExplicitTypeArguments") // It is used you absolute buffoon
event<MessageBulkDeleteEvent> {
check {
anyGuild()
Expand Down Expand Up @@ -169,7 +168,7 @@ class MessageDelete : Extension() {
messageLog.createEmbed {
author {
name = "Message deleted"
icon = proxiedMessage?.member?.avatarUrl ?: message.author?.avatar?.url
icon = proxiedMessage?.member?.avatarUrl ?: message.author?.avatar?.cdnUrl?.toUrl()
}
description =
"Location: ${message.channel.mention} " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MessageEdit : Extension() {
color = DISCORD_YELLOW
author {
name = "Message Edited"
icon = proxiedMessage?.member?.avatarUrl ?: message.author?.avatar?.url
icon = proxiedMessage?.member?.avatarUrl ?: message.author?.avatar?.cdnUrl?.toUrl()
}
description =
"Location: ${message.channel.mention} " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import dev.kord.core.supplier.EntitySupplyStrategy
import kotlinx.coroutines.delay
import org.hyacinthbots.lilybot.database.collections.AutoThreadingCollection
import org.hyacinthbots.lilybot.database.collections.ModerationConfigCollection
import org.hyacinthbots.lilybot.utils.canPingRole

class ModThreadInviting : Extension() {
override val name: String = "mod-thread-inviting"
Expand Down Expand Up @@ -41,7 +42,7 @@ class ModThreadInviting : Extension() {

val moderatorRole = channel.guild.getRoleOrNull(config.role) ?: return@action

if (!moderatorRole.mentionable) return@action
if (!canPingRole(moderatorRole, event.channel.guildId, kord)) return@action

val message = channel.createMessage {
content = "Placeholder message"
Expand Down
Loading

0 comments on commit efe5e49

Please sign in to comment.