Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Tabs -> Spaces #104

Open
wants to merge 2 commits into
base: java
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/xyz/rc24/bot/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
22 changes: 11 additions & 11 deletions src/main/java/xyz/rc24/bot/commands/wii/CodeCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/xyz/rc24/bot/commands/wii/ErrorInfoCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -262,7 +262,7 @@ private class InfoListFormat
private final Map<Integer, String> codeNotes = new HashMap<Integer, String>()
{{
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");
Expand All @@ -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.");
}};
}