= Saving allowed roles per guild

This commit is contained in:
Matthew Cech
2019-05-06 00:21:17 -07:00
parent 380fdbc605
commit 5eddc4645e
9 changed files with 110 additions and 16 deletions
+8 -1
View File
@@ -21,7 +21,14 @@ public class CommandChangeIndicator extends Command
return;
}
guild.SetCommandIndicator(arg.substring(0, 1));
String indicator = arg.substring(0, 1);
if(indicator.charAt(0) == '\n' || indicator.charAt(0) == '\t' || indicator.charAt(0) == '\r')
{
res.Call(LocStrings.Lookup("ChangeIndicatorError"));
return;
}
guild.SetCommandIndicator(indicator);
res.Call(String.format(LocStrings.Stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ public class CommandGuildRoleAdd extends Command
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String role = input.args.split(" ")[0];
if(guild.allowedRole.contains(role))
if(guild.roleList.contains(role))
{
if(guild.control.addRole(user.discordID, role))
{
+2 -2
View File
@@ -25,13 +25,13 @@ public class CommandGuildRoleAllowed extends Command
for(int i = 0; i < roles.length; i++)
{
role = roles[i].trim();
if(guild.allowedRole.contains(role))
if(guild.roleList.contains(role))
{
res.Call(LocStrings.Stub("GuildRoleAllowedDuplicate"));
}
else
{
guild.allowedRole.add(role);
guild.roleList.add(role);
res.Call(String.format(LocStrings.Stub("GuildRoleAllowedSuccess"), role));
}
}
+3 -3
View File
@@ -15,16 +15,16 @@ public class CommandGuildRoleList extends Command
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String roles = "";
if(guild.allowedRole.isEmpty())
if(guild.roleList.isEmpty())
{
res.Call(String.format(LocStrings.Stub("GuildRoleListEmpty")));
return;
}
for(int i = 0; i < guild.allowedRole.size(); i++)
for(int i = 0; i < guild.roleList.size(); i++)
{
if(i > 0)
roles += " and ";
roles += guild.allowedRole.get(i);
roles += guild.roleList.get(i);
}
res.Call(String.format(LocStrings.Stub("GuildRoleListOutput"), roles));
}
+2 -2
View File
@@ -25,9 +25,9 @@ public class CommandGuildRoleNotAllowed extends Command
for(int i = 0; i < roles.length; i++)
{
role = roles[i].trim();
if(guild.allowedRole.contains(role))
if(guild.roleList.contains(role))
{
guild.allowedRole.remove(role);
guild.roleList.remove(role);
res.Call(LocStrings.Stub("GuildRoleNotAllowedSuccess"));
}
else
+1 -1
View File
@@ -21,7 +21,7 @@ public class CommandGuildRoleRemove extends Command
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String role = input.args.split(" ")[0];
if(guild.allowedRole.contains(role))
if(guild.roleList.contains(role))
{
if(guild.control.removeRole(user.discordID, role))
{