diff --git a/README.md b/README.md index 1fefa06..5b217f1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Awoocord Plugins +## [Clump](plugins/Bocchi) | [Download](https://github.com/LavaDesu/Awoocord/raw/builds/Clump.zip) + +Group messages more leniently (e.g. mentions, attachments, etc..), reducing clutter and wasted space. + ## [RoleBlocks](plugins/Zinnia) | [Download](https://github.com/LavaDesu/Awoocord/raw/builds/RoleBlocks.zip) Apply the role colour as a background of usernames, improving contrast with some role colours @@ -19,4 +23,4 @@ Fixes slash commands not showing up. ## [ComponentsV2](canary/ComponentsV2) | [Download](https://github.com/LavaDesu/Awoocord/raw/builds/ComponentsV2Beta.zip) -Fix missing/empty bot messages using the new embed system. Such messages will be marked "CV2" as part of its tag. \ No newline at end of file +Fix missing/empty bot messages using the new embed system. Such messages will be marked "CV2" as part of its tag. diff --git a/plugins/Bocchi/build.gradle.kts b/plugins/Bocchi/build.gradle.kts new file mode 100644 index 0000000..18a8982 --- /dev/null +++ b/plugins/Bocchi/build.gradle.kts @@ -0,0 +1,16 @@ +version = "1.0.0" +description = "More lenient message grouping" + +android { + namespace = "moe.lava.awoocord.bocchi" +} + +aliucord { + // Changelog of your plugin + changelog.set(""" + # 1.0.0 + * Initial release >w< + """.trimIndent()) + + deploy.set(true) +} diff --git a/plugins/Bocchi/src/main/kotlin/moe/lava/awoocord/bocchi/Bocchi.kt b/plugins/Bocchi/src/main/kotlin/moe/lava/awoocord/bocchi/Bocchi.kt new file mode 100644 index 0000000..7fb9d22 --- /dev/null +++ b/plugins/Bocchi/src/main/kotlin/moe/lava/awoocord/bocchi/Bocchi.kt @@ -0,0 +1,42 @@ +package moe.lava.awoocord.bocchi + +import android.content.Context +import com.aliucord.annotations.AliucordPlugin +import com.aliucord.entities.Plugin +import com.aliucord.patcher.* +import com.discord.api.message.MessageTypes +import com.discord.models.message.Message +import com.discord.widgets.chat.list.model.WidgetChatListModelMessages + +@AliucordPlugin +@Suppress("unused") +class Bocchi : Plugin() { + override fun start(context: Context) { + patcher.instead( + "shouldConcatMessage", + WidgetChatListModelMessages.Items::class.java, + Message::class.java, + Message::class.java, + ) { (_, items: WidgetChatListModelMessages.Items, message: Message, message2: Message?) -> + val timeDiff = (message.timestamp?.g() ?: 0L) - (message2?.timestamp?.g() ?: 0L) + return@instead !( + message2 == null || + message2.isSystemMessage || + message.hasThread() || + message2.hasThread() || + message.type !in arrayOf(MessageTypes.DEFAULT, MessageTypes.LOCAL) || + message.author.id != message2.author.id || + timeDiff >= 420000 || // WidgetChatListModelMessages.MESSAGE_CONCAT_TIMESTAMP_DELTA_THRESHOLD +// items.listItemMostRecentlyAdded.type !in arrayOf(0, 1, 4, 21) || +// message2.hasAttachments() || +// message2.hasEmbeds() || +// message2.mentions?.isNotEmpty() == true || +// message.mentions?.isNotEmpty() == true || +// message.hasAttachments() || +// message.hasEmbeds() || + items.concatCount >= 5 || + (message.isWebhook && message.author?.username == message2.author.username) + ) + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index bbe70b9..bcdba5a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,6 +24,7 @@ rootProject.name = "Awoocord" val plugins = mapOf( "ComponentsV2Beta" to "canary/ComponentsV2", "SlashCommandsFixBeta" to "canary/SlashCommandsFix", + "Clump" to "plugins/Bocchi", "Scout" to "plugins/Scout", "RoleBlocks" to "plugins/Zinnia", )