Improve various small code quality issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-16 03:53:51 +01:00
parent d315b3f38a
commit 546637c188
11 changed files with 46 additions and 44 deletions

View File

@@ -263,10 +263,10 @@ public class UrbanDictionary
htmlContributor.indexOf("</a>") + 4);
contributorsNames.add(htmlContributorName
.replaceAll("<.*?>", "")); // remove all html tags;
.replaceAll("<.*?>", "")); // remove all html tags
submissionDates.add(htmlSubmitDate
.replaceAll("<.*?>", "")); // remove all html tags;
.replaceAll("<.*?>", "")); // remove all html tags
}
}

View File

@@ -70,6 +70,7 @@ public class AvatarCommand implements MessageCommand
resFound = true;
break;
} catch (NumberFormatException ignored) {
// ignored because we're running a check after this block
}
}

View File

@@ -70,6 +70,7 @@ public class BannerCommand implements MessageCommand
resFound = true;
break;
} catch (NumberFormatException ignored) {
// ignored because we're running a check after this block
}
}

View File

@@ -52,8 +52,6 @@ public class ClearCommand implements MessageCommand
@Override
public void runCommand(MessageReceivedEvent event, String label, String[] args)
{
String senderId = event.getMessage().getAuthor().getId();
// check if user is trying to run command in dms.
String error = ClearChat.checkDMs(event.getChannel());
if (error != null) {

View File

@@ -33,13 +33,16 @@ public class DiceRollCommand implements MessageCommand
@NotNull
@Override
public String getDescription() {
return "Roll dice. You can roll multiple dice at the same time." +
"\nExamples:" +
"\n - `d8 10` to roll an 8-sided die 10 times." +
"\n - `d12 3 d5 10` to roll a 12-sided die 3 times, and then a 5-sided die 10 times." +
"\n - `30` to roll a standard 6-sided die 30 times." +
"\n - `d10` to roll a 10-sided die once.";
public String getDescription()
{
return """
Roll dice. You can roll multiple dice at the same time.
Examples:
- `d8 10` to roll an 8-sided die 10 times.
- `d12 3 d5 10` to roll a 12-sided die 3 times, and then a 5-sided die 10 times.
- `30` to roll a standard 6-sided die 30 times.
- `d10` to roll a 10-sided die once.
""";
}
@Nullable

View File

@@ -11,10 +11,7 @@ import wtf.beatrice.hidekobot.commands.base.Alias;
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
public class HelpCommand implements MessageCommand
{
@@ -82,10 +79,11 @@ public class HelpCommand implements MessageCommand
"\nYou will find a list of commands organized in categories below.",
false);
for(CommandCategory category : commandCategories.keySet())
for(Map.Entry<CommandCategory, LinkedList<MessageCommand>> entry : commandCategories.entrySet())
{
StringBuilder commandsList = new StringBuilder();
LinkedList<MessageCommand> commandsOfThisCategory = commandCategories.get(category);
CommandCategory category = entry.getKey();
LinkedList<MessageCommand> commandsOfThisCategory = entry.getValue();
for(int pos = 0; pos < commandsOfThisCategory.size(); pos++)
{