From 9b52f119c24d788863fbad5f6334498196a8209f Mon Sep 17 00:00:00 2001 From: Gamebuster19901 Date: Wed, 24 Jun 2020 13:59:22 -0400 Subject: [PATCH 1/2] Tabs -> Spaces Having a mix of spaces and tabs makes viewing the code more difficult on some platforms (I.E. Github and Eclipse). The project seems to primarily use spaces, so this commit replaces all tabs with spaces. --- src/main/java/xyz/rc24/bot/Bot.java | 8 ++--- .../xyz/rc24/bot/commands/wii/CodeCmd.java | 22 ++++++------ .../rc24/bot/commands/wii/ErrorInfoCmd.java | 36 +++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/java/xyz/rc24/bot/Bot.java b/src/main/java/xyz/rc24/bot/Bot.java index 0127ed62..07a1984e 100644 --- a/src/main/java/xyz/rc24/bot/Bot.java +++ b/src/main/java/xyz/rc24/bot/Bot.java @@ -340,8 +340,8 @@ public OkHttpClient getHttpClient() return httpClient; } - public String getPrefix(Guild guild) - { - return getCore().getGuildSettings(guild).getPrefix(); - } + public String getPrefix(Guild guild) + { + return getCore().getGuildSettings(guild).getPrefix(); + } } diff --git a/src/main/java/xyz/rc24/bot/commands/wii/CodeCmd.java b/src/main/java/xyz/rc24/bot/commands/wii/CodeCmd.java index 2cb2e612..bd131330 100644 --- a/src/main/java/xyz/rc24/bot/commands/wii/CodeCmd.java +++ b/src/main/java/xyz/rc24/bot/commands/wii/CodeCmd.java @@ -177,23 +177,23 @@ private class HelpCmd extends Command this.name = "help"; this.help = "Shows help regarding codes."; this.category = Categories.WII; - this.guildOnly = false; + this.guildOnly = false; } @Override protected void execute(CommandEvent event) { - String prefix = event.isFromType(ChannelType.TEXT) ? bot.getPrefix(event.getGuild()) : "!"; - + String prefix = event.isFromType(ChannelType.TEXT) ? bot.getPrefix(event.getGuild()) : "!"; + String help = "**__Using the bot__**\n\n" + - "**Adding Wii:**\n" + "`" + prefix + "code add wii Wii Name Goes here 1234-5678-9012-3456`\n" + - "**Adding games:**\n `" + prefix + "code add game Game Name 1234-5678-9012`\n" + - "and many more types! Run `" + prefix + "code add` " + - "to see all supported code types right now, such as the 3DS, PlayStation 4 and Switch.\n\n" + - "**Editing codes**\n" + "`" + prefix + "code edit type Name 1234-5678-9012-3456`\n\n" + - "**Removing codes**\n" + "`" + prefix + "code remove type Name`\n\n" + - "**Looking up codes**\n" + "`" + prefix + "code lookup @user`\n\n" + - "**Adding a user's Wii**\n" + "`" + prefix + "add @user`\n" + "This will send you their wii, and then DM them your Wii/game wii."; + "**Adding Wii:**\n" + "`" + prefix + "code add wii Wii Name Goes here 1234-5678-9012-3456`\n" + + "**Adding games:**\n `" + prefix + "code add game Game Name 1234-5678-9012`\n" + + "and many more types! Run `" + prefix + "code add` " + + "to see all supported code types right now, such as the 3DS, PlayStation 4 and Switch.\n\n" + + "**Editing codes**\n" + "`" + prefix + "code edit type Name 1234-5678-9012-3456`\n\n" + + "**Removing codes**\n" + "`" + prefix + "code remove type Name`\n\n" + + "**Looking up codes**\n" + "`" + prefix + "code lookup @user`\n\n" + + "**Adding a user's Wii**\n" + "`" + prefix + "add @user`\n" + "This will send you their wii, and then DM them your Wii/game wii."; event.replyInDm(help, (success) -> event.reactSuccess(), (failure) -> event.replyError("Hey, " + event.getAuthor().getAsMention() + diff --git a/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java b/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java index 5c92e314..a6fdefc0 100644 --- a/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java +++ b/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java @@ -62,14 +62,14 @@ public class ErrorInfoCmd extends Command { private final boolean debug; private final OkHttpClient httpClient; - - private final Pattern CHANNEL = Pattern.compile("(NEWS|FORE)0{4}\\d{2}", Pattern.CASE_INSENSITIVE); - private final Pattern CHANNEL_CODE = Pattern.compile("0{4}\\d{2}"); - - private final Pattern CODE = Pattern.compile("\\d{1,6}"); + + private final Pattern CHANNEL = Pattern.compile("(NEWS|FORE)0{4}\\d{2}", Pattern.CASE_INSENSITIVE); + private final Pattern CHANNEL_CODE = Pattern.compile("0{4}\\d{2}"); + + private final Pattern CODE = Pattern.compile("\\d{1,6}"); - private final Gson gson = new Gson(); - private final Logger logger = RiiConnect24Bot.getLogger(ErrorInfoCmd.class); + private final Gson gson = new Gson(); + private final Logger logger = RiiConnect24Bot.getLogger(ErrorInfoCmd.class); public ErrorInfoCmd(Bot bot) { @@ -97,11 +97,11 @@ protected void execute(CommandEvent event) // Make sure the code's actually a code. Matcher codeCheck = CHANNEL_CODE.matcher(channelCheck.group()); if(!(codeCheck.find())) - throw new NumberFormatException(); + throw new NumberFormatException(); code = Integer.parseInt(codeCheck.group(0)); if(channelErrors.get(code) == null) - throw new NumberFormatException(); + throw new NumberFormatException(); } catch(NumberFormatException ignored) { @@ -124,15 +124,15 @@ protected void execute(CommandEvent event) // Validate if it is a number. Matcher codeCheck = CODE.matcher(event.getArgs()); if(!(codeCheck.find())) - throw new NumberFormatException(); - + throw new NumberFormatException(); + code = Integer.parseInt(codeCheck.group(0)); if(code == 0) - { + { // 0 returns an empty array (see https://forum.wii-homebrew.com/index.php/Thread/57051-Wiimmfi-Error-API-has-an-error/?postID=680936) // We'll just treat it as an error. throw new NumberFormatException(); - } + } } catch(NumberFormatException ignored) { @@ -262,7 +262,7 @@ private class InfoListFormat private final Map codeNotes = new HashMap() {{ put(101409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); - put(102032, "The IOS the app/game uses is not patched for RiiConnect24."); + put(102032, "The IOS the app/game uses is not patched for RiiConnect24."); put(102409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); put(103409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); put(104409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); @@ -285,12 +285,12 @@ private class InfoListFormat put(231401, "You are not using the patched WAD for the Everybody Votes Channel. Please follow this tutorial: https://wii.guide/riiconnect24-evc"); put(231409, "You are not using the patched WAD for the Everybody Votes Channel. Please follow this tutorial: https://wii.guide/riiconnect24-evc"); put(239001, "Your IOS probably aren't patched. Go to https://wii.guide/riiconnect24 for instructions on how to patch them. Occasionally, this error can mean it downloaded invalid data."); - put(257607, "You do not have a registered MAC address. Post a Mii to the Posting Plaza and try again."); - put(258503, "This is a 503 Service Unavailable error. If you are getting this on Nintendo Channel, just ignore it and press ok"); - put(258404, "This is a 404 Not Found error. If you are getting this on Nintendo Channel it means the item hasn't been added yet"); + put(257607, "You do not have a registered MAC address. Post a Mii to the Posting Plaza and try again."); + put(258503, "This is a 503 Service Unavailable error. If you are getting this on Nintendo Channel, just ignore it and press ok"); + put(258404, "This is a 404 Not Found error. If you are getting this on Nintendo Channel it means the item hasn't been added yet"); put(51330, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); put(51331, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); put(51332, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); - put(32007, "You are blocking System Menu updates using Priiloader. Disable them if you wish to update."); + put(32007, "You are blocking System Menu updates using Priiloader. Disable them if you wish to update."); }}; } From d550b61af023e28578c4b26e3d0acfbc08903a52 Mon Sep 17 00:00:00 2001 From: Gamebuster19901 Date: Wed, 24 Jun 2020 14:26:34 -0400 Subject: [PATCH 2/2] Fixed spacing --- .../java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java b/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java index a6fdefc0..e038227b 100644 --- a/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java +++ b/src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java @@ -262,7 +262,7 @@ private class InfoListFormat private final Map codeNotes = new HashMap() {{ put(101409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); - put(102032, "The IOS the app/game uses is not patched for RiiConnect24."); + put(102032, "The IOS the app/game uses is not patched for RiiConnect24."); put(102409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); put(103409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); put(104409, "If you are getting this problem while doing something with Wii Mail, check if you patched the nwc24msg.cfg correctly. https://bit.ly/2QUrsyD"); @@ -285,12 +285,12 @@ private class InfoListFormat put(231401, "You are not using the patched WAD for the Everybody Votes Channel. Please follow this tutorial: https://wii.guide/riiconnect24-evc"); put(231409, "You are not using the patched WAD for the Everybody Votes Channel. Please follow this tutorial: https://wii.guide/riiconnect24-evc"); put(239001, "Your IOS probably aren't patched. Go to https://wii.guide/riiconnect24 for instructions on how to patch them. Occasionally, this error can mean it downloaded invalid data."); - put(257607, "You do not have a registered MAC address. Post a Mii to the Posting Plaza and try again."); - put(258503, "This is a 503 Service Unavailable error. If you are getting this on Nintendo Channel, just ignore it and press ok"); - put(258404, "This is a 404 Not Found error. If you are getting this on Nintendo Channel it means the item hasn't been added yet"); + put(257607, "You do not have a registered MAC address. Post a Mii to the Posting Plaza and try again."); + put(258503, "This is a 503 Service Unavailable error. If you are getting this on Nintendo Channel, just ignore it and press ok"); + put(258404, "This is a 404 Not Found error. If you are getting this on Nintendo Channel it means the item hasn't been added yet"); put(51330, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); put(51331, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); put(51332, "Try the suggestions found on Nintendo's site: https://bit.ly/2OoC0c2"); - put(32007, "You are blocking System Menu updates using Priiloader. Disable them if you wish to update."); + put(32007, "You are blocking System Menu updates using Priiloader. Disable them if you wish to update."); }}; }