public AuditableRestAction<Void> ban(String userId, int delDays) return ban(userId, delDays, null);
public AuditableRestAction<Void> ban(Member member, int delDays) return ban(member, delDays, null);
public AuditableRestAction<Void> ban(User user, int delDays) return ban(user, delDays, null);
return ban(member.getUser(), delDays, reason);
return ban(user, delDays, reason);
@Override protected boolean punish(DiscordBot bot, Guild guild, Member member) { bot.queue.add(guild.getController().ban(member, 7)); return true; } }
@Override protected boolean punish(DiscordBot bot, Guild guild, Member member) { bot.queue.add(guild.getController().ban(member, 5), t -> guild.getController().unban(member.getUser()).complete()); return true; } }
private boolean banUserById(AvaIre avaire, Command command, CommandMessage context, long userId, String[] args, boolean soft) { String reason = generateReason(args); context.getGuild().getController().ban(String.valueOf(userId), soft ? 0 : 7, String.format("%s - %s#%s (%s)", reason, context.getAuthor().getName(), context.getAuthor().getDiscriminator(), context.getAuthor().getId() )).queue(aVoid -> { User user = avaire.getShardManager().getUserById(userId); if (user != null) { Modlog.log(avaire, context, new ModlogAction( soft ? ModlogType.SOFT_BAN : ModlogType.BAN, context.getAuthor(), user, reason )); } else { Modlog.log(avaire, context, new ModlogAction( soft ? ModlogType.SOFT_BAN : ModlogType.BAN, context.getAuthor(), userId, reason )); } context.makeSuccess(context.i18n("success")) .set("target", userId) .set("reason", reason) .queue(ignoreMessage -> context.delete().queue(null, RestActionUtil.ignore)); }, throwable -> context.makeWarning(context.i18n("failedToBan")) .set("target", userId) .set("error", throwable.getMessage()) .queue()); return true; }
private boolean banMemberOfServer(AvaIre avaire, Command command, CommandMessage context, User user, String[] args, boolean soft) { if (userHasHigherRole(user, context.getMember())) { return command.sendErrorMessage(context, context.i18n("higherRole")); } if (!context.getGuild().getSelfMember().canInteract(context.getGuild().getMember(user))) { return sendErrorMessage(context, context.i18n("userHaveHigherRole", user.getAsMention())); } String reason = generateReason(args); ModlogAction modlogAction = new ModlogAction( soft ? ModlogType.SOFT_BAN : ModlogType.BAN, context.getAuthor(), user, reason ); String caseId = Modlog.log(avaire, context, modlogAction); Modlog.notifyUser(user, context.getGuild(), modlogAction, caseId); context.getGuild().getController().ban(user, soft ? 0 : 7, String.format("%s - %s#%s (%s)", reason, context.getAuthor().getName(), context.getAuthor().getDiscriminator(), context.getAuthor().getId() )).queue(aVoid -> { context.makeSuccess(context.i18n("success")) .set("target", user.getName() + "#" + user.getDiscriminator()) .set("reason", reason) .queue(); }, throwable -> context.makeWarning(context.i18n("failedToBan")) .set("target", user.getName() + "#" + user.getDiscriminator()) .set("error", throwable.getMessage()) .queue()); return true; }
channel.getGuild().getController().ban(target, 7, reason).queue(aVoid -> channel.sendMessage(new EmbedBuilder().setColor(Color.GREEN) .setDescription("The ban hammer has been struck on " + target.getName() break; case SOFTBAN: channel.getGuild().getController().ban(target, 7, reason).queue(aVoid -> { channel.sendMessage(new EmbedBuilder().setColor(Color.GREEN) .setDescription(target.getName() + " was softly hit with the ban hammer... " + break; case FORCE_BAN: channel.getGuild().getController().ban(target.getId(), 7, reason).queue(aVoid -> channel.sendMessage(new EmbedBuilder().setColor(Color.GREEN) .setDescription("The ban hammer has been forcefully struck on " + target.getName() case TEMP_BAN: { Period period = new Period(duration); channel.getGuild().getController().ban(channel.getGuild().getMember(target), 7, reason).queue(aVoid -> { channel.sendMessage(new EmbedBuilder() .setDescription("The ban hammer has been struck on " + target.getName() + " for "