From 54389f2e2be8b21a5591308f7b3cba241b2e07f2 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 18 Jan 2025 13:38:31 +0700 Subject: [PATCH] feat: alias InfoCommand to discord, creator, botuser, and uptime which on each alias just does the action in the main `info` --- build-number.txt | 2 +- .../java/me/chayapak1/chomens_bot/commands/InfoCommand.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build-number.txt b/build-number.txt index 3559f242..063fa394 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1477 \ No newline at end of file +1478 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/InfoCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/InfoCommand.java index 2dd7ed2f..f428783d 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/InfoCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/InfoCommand.java @@ -57,7 +57,7 @@ public class InfoCommand extends Command { "botlogintime", "uptime" }, - new String[] {}, + new String[] { "creator", "discord", "botuser", "uptime" }, TrustLevel.PUBLIC, false ); @@ -69,7 +69,9 @@ public class InfoCommand extends Command { final Bot bot = context.bot; - final String action = context.getString(false, false, true); + final String action = !context.userInputCommandName.equals(this.name) ? // if the input command is not `info` + context.userInputCommandName : // use that as the action (e.g. "discord", "creator") + context.getString(false, false, true); // else just take the argument of `info` switch (action) { case "creator" -> {