From 2bd462da1e1ca98eb4a321b91e09b0972bcc83dc Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Sat, 30 Nov 2024 16:06:30 +0000 Subject: [PATCH 1/5] Update net.dv8tion.JDA 5.0.1 -> 5.2.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 04a17ba..82725dd 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ net.dv8tion JDA - 5.0.1 + 5.2.1 io.github.freya022 From 9f784d83eb8be60cb0e91833fa1fac841bccd89e Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Sat, 30 Nov 2024 16:07:32 +0000 Subject: [PATCH 2/5] Remove reference to token config from README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 582139d..a5bf114 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ A multipurpose Discord bot written in Java. ## Config file schema ```json { - "token": "your_token", - "prefix": "oki!" + "token": "your_token" } ``` From cf947432bb8abbc3e9df85e4fc76a010a65f8f66 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Sat, 30 Nov 2024 16:15:52 +0000 Subject: [PATCH 3/5] Update README.md --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a5bf114..6975308 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,14 @@
A multipurpose Discord bot written in Java. -## Tested Environments -- Java 21+ (May work on older versions but untested) +## Required Environment +- Java 17+ (May work on older versions but untested) - Maven ### Tested Operating Systems -- macOS 14.4.1 -- Windows 10 (22H2) +- macOS 14 & 15 (arm64) +- Windows 10 22H2 (x86_64) +- Debian 12 (x86_64) --- @@ -28,9 +29,11 @@ A multipurpose Discord bot written in Java. ## Commands -| Command | Description | Arguments | Aliases | -|---------|------------------------------------------------------------------------------|-------------------------------------|---------| -| `about` | Gets information about the bot | None | None | -| `ping` | Gets the bot's gateway & rest ping | None | None | -| `whois` | Gets information about the specified user (message author if none specified) | `[user ping]` | None | -| `mute` | Mutes a member for a specified amount of time | `[user ping]`, `[timeout duration]` | None | \ No newline at end of file +| Command | Description | Arguments | +|-------------------|------------------------------------------------------------------------------|-----------------------------------------------------------| +| `/ping` | Gets the bot's gateway & rest ping | None | +| `/whois` | Gets information about the specified user (message author if none specified) | `[member]` | +| `/timeout set` | Times out a member for a specified amount of time | `[member]`, `[duration]`, `(reason)` | +| `/timeout get` | Gets the current timeout status of the specified member | `[member]` | +| `/timeout cancel` | Cancels the specified users timeout | `[member]`, `(reason)` | +| `/poll` | Creates a poll | `[title]`, `[duration]`, `[options]`, `(multiple-choice)` | From f4eb1e79bf0de50cbc4393205c889d029e65ba83 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Sun, 22 Dec 2024 00:05:45 +0000 Subject: [PATCH 4/5] Update deps, add warn command --- pom.xml | 14 ++++++-- .../hypr/doki/commands/moderation/Warn.java | 34 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/hypr/doki/commands/moderation/Warn.java diff --git a/pom.xml b/pom.xml index 82725dd..5ccf8f2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.hypr doki - 1.0.0 + 1.0.6 17 @@ -39,7 +39,7 @@ ch.qos.logback logback-classic - 1.5.6 + 1.5.13 org.mariadb.jdbc @@ -56,5 +56,15 @@ commons-dbutils 1.8.1 + + ch.qos.logback + logback-core + 1.5.13 + + + com.google.protobuf + protobuf-java + 4.28.2 + \ No newline at end of file diff --git a/src/main/java/net/hypr/doki/commands/moderation/Warn.java b/src/main/java/net/hypr/doki/commands/moderation/Warn.java new file mode 100644 index 0000000..4c6be60 --- /dev/null +++ b/src/main/java/net/hypr/doki/commands/moderation/Warn.java @@ -0,0 +1,34 @@ +package net.hypr.doki.commands.moderation; + +import com.freya02.botcommands.api.annotations.BotPermissions; +import com.freya02.botcommands.api.annotations.CommandMarker; +import com.freya02.botcommands.api.annotations.UserPermissions; +import com.freya02.botcommands.api.application.ApplicationCommand; +import com.freya02.botcommands.api.application.annotations.AppOption; +import com.freya02.botcommands.api.application.slash.GuildSlashEvent; +import com.freya02.botcommands.api.application.slash.annotations.JDASlashCommand; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Member; + +@CommandMarker +@BotPermissions(Permission.MODERATE_MEMBERS) +@UserPermissions(Permission.MODERATE_MEMBERS) +public class Warn extends ApplicationCommand { + @JDASlashCommand( + name = "warn", + description = "Warns a member" + ) + public void warn(GuildSlashEvent event, + @AppOption(name = "member", description = "The member to warn") Member member, + @AppOption(name = "reason", description = "The reason for warning them") String reason) { + EmbedBuilder warnEmbed = new EmbedBuilder() + .setTitle(String.format("You were warned in %s", event.getGuild().getName())) + .setDescription(String.format("**Reason:** %s", reason)); + member.getUser().openPrivateChannel().queue((dm) -> dm.sendMessageEmbeds(warnEmbed.build()).queue( + success -> event.replyFormat("Warned %s for %s", member.getAsMention(), reason).setEphemeral(true).queue(), + // User has blocked bot or disabled DMs + error -> event.replyFormat("Warned %s for %s\n-# (Unable to DM user)", member.getAsMention(), reason).queue() + )); + } +} \ No newline at end of file From 7ee79862c8c1cd31d8ef19f92b893dc9780506d0 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Sun, 22 Dec 2024 00:05:59 +0000 Subject: [PATCH 5/5] Stupid intellij config crap --- .idea/misc.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 079ae5f..94fad1c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -