use of com.gamebuster19901.excite.bot.audit.ban.Banee in project ExciteBot by TheGameCommunity.
the class PardonCommand method pardon.
@SuppressWarnings("rawtypes")
private static final int pardon(MessageContext context, long baneeOrBanID) {
if (context.isAdmin()) {
Ban ban = Ban.getBanByAuditId(context, baneeOrBanID);
if (ban != null) {
return pardon(context, ban);
}
Banee banee = Banee.getBanee(context, baneeOrBanID);
return pardon(context, banee);
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 1;
}
use of com.gamebuster19901.excite.bot.audit.ban.Banee in project ExciteBot by TheGameCommunity.
the class Ban method addBan.
@SuppressWarnings({ "rawtypes", "deprecation" })
public static Ban addBan(MessageContext context, Banee banee, String reason, Duration banDuration, Instant banExpire, long pardon) {
Audit parent = Audit.addAudit(context, AuditType.BAN, reason);
PreparedStatement st;
context.sendMessage(banee.getClass().getCanonicalName());
try {
st = Insertion.insertInto(AUDIT_BANS).setColumns(AUDIT_ID, BAN_DURATION, BAN_EXPIRE, BANNED_ID, BANNED_USERNAME).to(parent.getID(), banDuration, banExpire, banee.getID(), banee.getName()).prepare(context, true);
st.execute();
Ban ret = getBanByAuditId(context, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.ban.Banee in project ExciteBot by TheGameCommunity.
the class Banee method getBanee.
@SuppressWarnings("rawtypes")
public static Banee getBanee(MessageContext context, long id) {
DiscordUser discord = DiscordUser.getDiscordUserIncludingUnknown(context, id);
Player player = Player.getPlayerByID(context, (int) id);
if (!player.isKnown()) {
return discord;
}
return player;
}
use of com.gamebuster19901.excite.bot.audit.ban.Banee in project ExciteBot by TheGameCommunity.
the class Banee method getBanee.
@Nullable
@SuppressWarnings({ "rawtypes", "deprecation" })
public static Banee getBanee(MessageContext context, String name) {
DiscordUser[] discords = DiscordUser.getDiscordUsersWithUsername(context, name);
Player[] players = Player.getPlayersByName(context, name);
int amount = discords.length + players.length;
if (amount == 1) {
if (discords.length == 1) {
return discords[0];
}
return players[0];
} else if (amount < 1) {
context.sendMessage("Could not find a discord user or player named " + name);
} else if (amount > 1) {
String ret = name + " is ambiguous, please supply an ID instead.\n\nAmbiguities\n\n:";
if (discords.length > 0) {
ret = ret + "Discord Users:\n";
for (DiscordUser discord : discords) {
ret = ret + discord.toDetailedString();
}
}
if (players.length > 0) {
ret = ret + "Profiles:\n";
for (Player player : players) {
ret = ret + player.toFullString();
}
}
context.sendMessage(ret);
}
return null;
}
use of com.gamebuster19901.excite.bot.audit.ban.Banee in project ExciteBot by TheGameCommunity.
the class PardonCommand method pardon.
@SuppressWarnings("rawtypes")
private static final int pardon(MessageContext context, Banee banee) {
if (context.isAdmin()) {
Ban ban = banee.getLongestActiveBan(context);
if (ban == null) {
context.sendMessage(banee.getIdentifierName() + " is not banned.");
return 1;
}
Pardon pardon = Pardon.addPardonByAuditID(context, ban.getID());
if (pardon != null) {
context.sendMessage("pardoned the longest ban (#" + ban.getID() + ") of " + banee.getIdentifierName());
}
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 1;
}
Aggregations