+Added Fetch command

Added Fetch command
Refactored AddGuildRole and AllowedGuildRole to be standard
Added GuildRoleRemove
This commit is contained in:
Alex Stewart
2019-04-18 22:13:49 -07:00
parent 448fb6bf92
commit c1c7b1f891
10 changed files with 180 additions and 70 deletions
+39
View File
@@ -0,0 +1,39 @@
package commands;
import core.Command;
import core.LocStrings;
import dataStructures.KittyChannel;
import dataStructures.KittyGuild;
import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
import dataStructures.Response;
import dataStructures.UserInput;
public class CommandGuildRoleAllowed extends Command
{
public CommandGuildRoleAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("GuildRoleAllowedInfo"); }
@Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String [] roles = input.args.split(",");
String role;
for(int i = 0; i < roles.length; i++)
{
role = roles[i].trim();
if(guild.allowedRole.contains(role))
{
res.Call(LocStrings.Stub("GuildRoleAllowedDuplicate"));
}
else
{
guild.allowedRole.add(role);
res.Call(String.format(LocStrings.Stub("GuildRoleAllowedSuccess"), role));
}
}
}
}