+Added RoleNotAllowed command
Added ability to revoke role addition for kittybot
This commit is contained in:
@@ -63,3 +63,5 @@ RP\.txt
|
||||
rp\.txt
|
||||
Rp\.txt
|
||||
rP\.txt
|
||||
|
||||
.log
|
||||
@@ -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 CommandGuildRoleNotAllowed extends Command
|
||||
{
|
||||
public CommandGuildRoleNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return LocStrings.Stub("GuildRoleNotAllowedInfo"); }
|
||||
|
||||
@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))
|
||||
{
|
||||
guild.allowedRole.remove(role);
|
||||
res.Call(LocStrings.Stub("GuildRoleNotAllowedSuccess"));
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleNotAllowedFailure"), role));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,6 +342,7 @@ public class ObjectBuilderFactory
|
||||
manager.Register(LocCommands.Stub("rating"), new CommandRating(KittyRole.Admin, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("indicator"), new CommandChangeIndicator(KittyRole.Admin, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("guildroleallowed"), new CommandGuildRoleAllowed(KittyRole.Admin, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("guildrolenotallowed"), new CommandGuildRoleNotAllowed(KittyRole.Admin, KittyRating.Safe));
|
||||
|
||||
manager.Register(LocCommands.Stub("poll"), new CommandPollManage(KittyRole.Mod, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
||||
|
||||
@@ -19,7 +19,7 @@ public class GlobalLog
|
||||
{
|
||||
DateFormat dF = new SimpleDateFormat("yyyy_MM_dd_HH-mm");
|
||||
Date today = new Date();
|
||||
outputLog = new PrintWriter((dF.format(today) + "Log.txt"), "UTF-8");
|
||||
outputLog = new PrintWriter((dF.format(today) + ".log"), "UTF-8");
|
||||
}
|
||||
|
||||
private static void Write(String status, LogFilter filter, String body)
|
||||
|
||||
Reference in New Issue
Block a user