+Added Fetch command
Added Fetch command Refactored AddGuildRole and AllowedGuildRole to be standard Added GuildRoleRemove
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
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 CommandFetch extends Command
|
||||
{
|
||||
public CommandFetch(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return LocStrings.Stub("FetchInfo"); }
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
String emote = input.args.split(" ")[0];
|
||||
if(emote.startsWith("<") && emote.endsWith(">"))
|
||||
{
|
||||
int num = (int)(Math.random() * 6) + 1;
|
||||
switch(num)
|
||||
{
|
||||
case 1:
|
||||
res.Call(String.format(LocStrings.Stub("FetchBringBack"), emote));
|
||||
break;
|
||||
case 2:
|
||||
res.Call(String.format(LocStrings.Stub("FetchRunAway")));
|
||||
break;
|
||||
case 3:
|
||||
res.Call(String.format(LocStrings.Stub("FetchBringBackWrong"), guild.emoji.get((int)(Math.random() * guild.emoji.size()) + 1)));
|
||||
break;
|
||||
case 4:
|
||||
res.Call(String.format(LocStrings.Stub("FetchEat"), emote));
|
||||
break;
|
||||
case 5:
|
||||
res.Call(String.format(LocStrings.Stub("FetchCatchRun"), emote));
|
||||
break;
|
||||
case 6:
|
||||
res.Call(String.format(LocStrings.Stub("FetchStare"), user.name));
|
||||
break;
|
||||
default:
|
||||
res.Call("" + num);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("FetchError")));
|
||||
System.out.println(emote);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,12 @@ import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
|
||||
public class CommandAddGuildRole extends Command
|
||||
public class CommandGuildRoleAdd extends Command
|
||||
{
|
||||
public CommandAddGuildRole(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
public CommandGuildRoleAdd(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return LocStrings.Stub("AddGuildRoleInfo"); };
|
||||
public String HelpText() { return LocStrings.Stub("GuildRoleAddInfo"); };
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
@@ -25,16 +25,16 @@ public class CommandAddGuildRole extends Command
|
||||
{
|
||||
if(guild.control.addRole(user.discordID, role))
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("AddGuildRoleSuccess"), role, user.name));
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleAddSuccess"), role, user.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("AddGuildRoleFailure"), role, user.name));
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleAddFailure"), role, user.name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("AddGuildRoleNotAllowed"), role));
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleAddNotAllowed"), role));
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -10,12 +10,12 @@ import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
|
||||
public class CommandAllowedGuildRole extends Command
|
||||
public class CommandGuildRoleAllowed extends Command
|
||||
{
|
||||
public CommandAllowedGuildRole(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
public CommandGuildRoleAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return LocStrings.Stub("AllowedGuildRoleInfo"); }
|
||||
public String HelpText() { return LocStrings.Stub("GuildRoleAllowedInfo"); }
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
@@ -27,12 +27,12 @@ public class CommandAllowedGuildRole extends Command
|
||||
role = roles[i].trim();
|
||||
if(guild.allowedRole.contains(role))
|
||||
{
|
||||
res.Call(LocStrings.Stub("AllowedGuildRoleDuplicate"));
|
||||
res.Call(LocStrings.Stub("GuildRoleAllowedDuplicate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.allowedRole.add(role);
|
||||
res.Call(String.format(LocStrings.Stub("AllowedGuildRoleSuccess"), role));
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleAllowedSuccess"), role));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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 CommandGuildRoleRemove extends Command
|
||||
{
|
||||
public CommandGuildRoleRemove(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return LocStrings.Stub("GuildRoleRemoveInfo"); };
|
||||
|
||||
@Override
|
||||
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.control.removeRole(user.discordID, role))
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleRemoveSuccess"), role, user.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleRemoveFailure"), role, user.name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleRemoveNotAllowed"), role));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user