use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class DiscordUser method ban.
@SuppressWarnings({ "rawtypes", "unchecked" })
public Ban ban(MessageContext context, Duration duration, String reason) {
Ban discordBan = Ban.addBan(context, this, reason, duration);
sendMessage(context, this.toDetailedString() + " has been banned for " + TimeUtils.readableDuration(duration) + " with the reason: \n\n\"" + reason + "\"");
sendMessage(new MessageContext(this), this.getName() + " " + reason);
return discordBan;
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class BanCommand method banProfile.
@SuppressWarnings("rawtypes")
private static int banProfile(MessageContext context, Player profile, Duration duration, String reason) {
if (context.isAdmin()) {
Ban ban = profile.ban(context, duration, reason);
String message = "Banned profile " + profile.getPrettyDiscord() + ": \n\n" + ban;
if (context.isConsoleMessage()) {
context.sendMessage(message);
} else {
PrivateChannel privateChannel;
if (context.isPrivateMessage()) {
privateChannel = (PrivateChannel) context.getChannel();
} else {
privateChannel = context.getDiscordAuthor().getJDAUser().openPrivateChannel().complete();
}
privateChannel.sendMessage(message);
}
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 1;
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class BanCommand method banDiscordUser.
@SuppressWarnings("rawtypes")
private static int banDiscordUser(MessageContext context, DiscordUser user, Duration duration, String reason) {
if (context.isAdmin()) {
Ban ban = user.ban(context, duration, parseReason(duration, reason));
String message = "Banned discord user" + user + ": \n\n" + ban;
if (context.isConsoleMessage()) {
context.sendMessage(message);
} else {
PrivateChannel privateChannel;
if (context.isPrivateMessage()) {
privateChannel = (PrivateChannel) context.getChannel();
} else {
privateChannel = context.getDiscordAuthor().getJDAUser().openPrivateChannel().complete();
}
privateChannel.sendMessage(message);
}
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 1;
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class Ban method getBansOfID.
@SuppressWarnings("rawtypes")
public static Ban[] getBansOfID(MessageContext context, long id) {
if (id == -1 || id == -2) {
throw new AssertionError();
}
Result results = Table.selectAllFromJoinedUsingWhere(new MessageContext(context.getAuthor()), AUDITS, AUDIT_BANS, AUDIT_ID, new Comparison(BANNED_ID, EQUALS, id));
ArrayList<Ban> bans = new ArrayList<Ban>();
while (results.next()) {
bans.add(new Ban(results.getRow()));
}
return bans.toArray(new Ban[] {});
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban 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