=Fixed role case issue

This commit is contained in:
Alex
2019-08-13 16:11:35 -04:00
parent 5972408627
commit c29fb1dd1f
4 changed files with 23 additions and 17 deletions
+3 -3
View File
@@ -159,7 +159,7 @@
"Localized Strings","GuildRoleNotAllowedSuccess","Removed %s from the allowed roles!"
"Localized Strings","GuildRoleRemoveFailure","I wasn't able to remove %s from %s!"
"Localized Strings","GuildRoleRemoveInfo","Removes a role from you! Just remember to spell it right!"
"Localized Strings","GuildRoleRemoveNotAllowed","You're not allowed to add %s!"
"Localized Strings","GuildRoleRemoveNotAllowed","You're not allowed to remove %s!"
"Localized Strings","GuildRoleRemoveSuccess","Removed %s from %s!"
"Localized Strings","HelpBuilderInfo","Emit help for all commands as formatted HTML"
"Localized Strings","HelpDisplay","You can get help with a specific command by typing `!help command`! General Commands: `boop, roll, choose, help, info, vote, results, showpoll, wolfram, cplus, java, beans, role, bet, yeet`"
@@ -198,7 +198,7 @@
"Localized Strings","RaffleEndFailure","I don't think there's one going!"
"Localized Strings","RaffleEndInfo",""
"Localized Strings","RaffleEndSuccess","You ended the raffle!"
"Localized Strings","RaffleInfo","Raffle is a super command!\n\t`raffle start \"# of beans\"` will start a raffle with an entrance fee of the number of beans! Defaults to 100.\n\t`raffle end` will stop the raffle!\n\t`raffle spin` will choose a winner, you can only win once!\n\t`raffle join` will add you to the raffle!"
"Localized Strings","RaffleInfo","Raffle is a super command!\n\t`raffle start \""# of beans\""` will start a raffle with an entrance fee of the number of beans! Defaults to 100.\n\t`raffle end` will stop the raffle!\n\t`raffle spin` will choose a winner, you can only win once!\n\t`raffle join` will add you to the raffle!"
"Localized Strings","RaffleJoinFailure","You can't join again!"
"Localized Strings","RaffleJoinInfo",""
"Localized Strings","RaffleJoinSuccess","You joined the raffle! Good luck!"
@@ -212,7 +212,7 @@
"Localized Strings","RatingInfo","'0' is fully sfw (Derpi and e621 searches are disabled)\n'1' is filtered (kitty auto appends a sfw tag on any searches)\n'2' is nsfw (any search will go through). Some other words are supported for setting filter as well."
"Localized Strings","RatingInvalid","Invalid content rating"
"Localized Strings","RatingWarning","Warning: NSFW may slip through, images are only based on tags on their respective sites!"
"Localized Strings","RemindInfo","`remind \"# of mins\" \"reminder\"` I'll remind you to do something!"
"Localized Strings","RemindInfo","`remind \""# of mins\"" \""reminder\""` I'll remind you to do something!"
"Localized Strings","RoleChanged","Changed %s to role `%s`!"
"Localized Strings","RoleError","You aren't allowed to do that! You must have the KittyRole '%' or higher!"
"Localized Strings","RoleInfo","Will show the current role you have, Admins can change others roles with input of 'role x @y' with x being blacklist, general, mod, or admin.\nBlacklist will not allow the user to interact with kitty anymore, general mod and admin will give the user access to those commands."
Can't render this file because it contains an unexpected character in line 201 and column 80.
+4 -4
View File
@@ -22,21 +22,21 @@ public class SubCommandAdd extends SubCommand
String formatted = "";
for(int i = 0; i < roles.length; i++)
{
role = roles[i].trim();
role = roles[i].trim().toLowerCase();
if(guild.roleList.contains(role))
{
if(guild.control.addRole(user.discordID, role))
{
formatted += String.format(LocStrings.stub("GuildRoleAddSuccess"), role, user.name);
formatted += String.format(LocStrings.stub("GuildRoleAddSuccess"), role, user.name) + "\n";
}
else
{
formatted += String.format(LocStrings.stub("GuildRoleAddFailure"), role, user.name);
formatted += String.format(LocStrings.stub("GuildRoleAddFailure"), role, user.name) + "\n";
}
}
else
{
formatted += String.format(LocStrings.stub("GuildRoleAddNotAllowed"), role);
formatted += String.format(LocStrings.stub("GuildRoleAddNotAllowed"), role) + "\n";
}
}
return new SubCommandFormattable(formatted);
+1 -1
View File
@@ -29,6 +29,6 @@ public class SubCommandList extends SubCommand
roles += "\n";
roles += guild.roleList.get(i);
}
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleListOutput"), roles));
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleListOutput") + "\n", roles));
}
}
+15 -9
View File
@@ -12,23 +12,29 @@ public class SubCommandRemove extends SubCommand
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
{
String role = input.args.split(" ")[0];
String [] roles = input.args.split(",");
String role;
String formatted = "";
if(guild.roleList.contains(role))
for(int i = 0; i < roles.length; i ++)
{
if(guild.control.removeRole(user.discordID, role))
role = roles[i].trim().toLowerCase();
if(guild.roleList.contains(role))
{
formatted += (String.format(LocStrings.stub("GuildRoleRemoveSuccess"), role, user.name));
if(guild.control.removeRole(user.discordID, role))
{
formatted += (String.format(LocStrings.stub("GuildRoleRemoveSuccess"), role, user.name)) + "\n";
}
else
{
formatted += (String.format(LocStrings.stub("GuildRoleRemoveFailure"), role, user.name)) + "\n";
}
}
else
{
formatted += (String.format(LocStrings.stub("GuildRoleRemoveFailure"), role, user.name));
formatted += (String.format(LocStrings.stub("GuildRoleRemoveNotAllowed"), role)) + "\n";
}
}
else
{
formatted += (String.format(LocStrings.stub("GuildRoleRemoveNotAllowed"), role));
}
return new SubCommandFormattable(formatted);
}