Search in sources :

Example 1 with Action

use of com.sx4.bot.entities.mod.action.Action in project Sx4 by sx4-discord-bot.

the class OffencesCommand method onCommand.

public void onCommand(Sx4CommandEvent event, @Argument(value = "user", endless = true, nullDefault = true) Member member) {
    Bson filter = Filters.eq("guildId", event.getGuild().getIdLong());
    if (member != null) {
        filter = Filters.and(filter, Filters.eq("targetId", member.getIdLong()));
    }
    event.getMongo().getOffences(filter, Sorts.descending("_id")).whenComplete((iterable, exception) -> {
        if (ExceptionUtility.sendExceptionally(event, exception)) {
            return;
        }
        try {
            List<Document> data = iterable.into(new ArrayList<>());
            if (data.isEmpty()) {
                event.replyFailure((member == null ? "This server" : "**" + member.getUser().getAsTag() + "**") + " has no offences").queue();
                return;
            }
            User user = member == null ? null : member.getUser();
            PagedResult<Document> paged = new PagedResult<>(event.getBot(), data).setPerPage(6).setCustomFunction(page -> {
                EmbedBuilder embed = new EmbedBuilder().setAuthor("Offences", null, member == null ? event.getGuild().getIconUrl() : user.getEffectiveAvatarUrl()).setTitle("Page " + page.getPage() + "/" + page.getMaxPage()).setFooter(PagedResult.DEFAULT_FOOTER_TEXT);
                page.forEach((offence, index) -> {
                    Action action = Action.fromData(offence.get("action", Document.class));
                    ObjectId id = offence.getObjectId("_id");
                    OffsetDateTime time = OffsetDateTime.ofInstant(Instant.ofEpochSecond(id.getTimestamp()), ZoneOffset.UTC);
                    long targetId = offence.getLong("targetId");
                    User target = member == null ? event.getShardManager().getUserById(targetId) : user;
                    String targetContent = target == null ? "Anonymous#0000 (" + targetId + ")" : target.getAsTag();
                    long moderatorId = offence.getLong("moderatorId");
                    User moderator = event.getShardManager().getUserById(moderatorId);
                    String moderatorContent = moderator == null ? "Anonymous#0000 (" + moderatorId + ")" : moderator.getAsTag();
                    embed.addField(action.toString(), String.format("Target: %s\nModerator: %s\nReason: %s\nTime: %s", targetContent, moderatorContent, offence.get("reason", "None Given"), time.format(this.formatter)), true);
                });
                return new MessageBuilder().setEmbeds(embed.build());
            });
            paged.execute(event);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    });
}
Also used : Action(com.sx4.bot.entities.mod.action.Action) User(net.dv8tion.jda.api.entities.User) ObjectId(org.bson.types.ObjectId) Document(org.bson.Document) Bson(org.bson.conversions.Bson) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) MessageBuilder(net.dv8tion.jda.api.MessageBuilder) OffsetDateTime(java.time.OffsetDateTime) PagedResult(com.sx4.bot.paged.PagedResult)

Example 2 with Action

use of com.sx4.bot.entities.mod.action.Action in project Sx4 by sx4-discord-bot.

the class ModLogCommand method view.

@Command(value = "view", aliases = { "viewcase", "view case", "list" }, description = "View a mod log case from the server")
@CommandId(70)
@Examples({ "modlog view 5e45ce6d3688b30ee75201ae", "modlog view" })
public void view(Sx4CommandEvent event, @Argument(value = "id", nullDefault = true) ObjectId id) {
    Bson projection = Projections.include("moderatorId", "reason", "targetId", "action");
    if (id == null) {
        List<Document> allData = event.getMongo().getModLogs(Filters.eq("guildId", event.getGuild().getIdLong()), projection).into(new ArrayList<>());
        if (allData.isEmpty()) {
            event.replyFailure("There are no mod logs in this server").queue();
            return;
        }
        PagedResult<Document> paged = new PagedResult<>(event.getBot(), allData).setDisplayFunction(data -> {
            long targetId = data.getLong("targetId");
            User target = event.getShardManager().getUserById(targetId);
            return Action.fromData(data.get("action", Document.class)) + " to `" + (target == null ? targetId : target.getAsTag() + "`");
        }).setIncreasedIndex(true);
        paged.onSelect(select -> event.reply(ModLog.fromData(select.getSelected()).getEmbed(event.getShardManager())).queue());
        paged.execute(event);
    } else {
        Document data = event.getMongo().getModLogById(Filters.and(Filters.eq("_id", id), Filters.eq("guildId", event.getGuild().getIdLong())), projection);
        if (data == null) {
            event.replyFailure("I could not find a mod log with that id").queue();
            return;
        }
        event.reply(ModLog.fromData(data).getEmbed(event.getShardManager())).queue();
    }
}
Also used : Document(org.bson.Document) CancelException(com.sx4.bot.waiter.exception.CancelException) WebhookClient(club.minnced.discord.webhook.WebhookClient) Command(com.jockie.bot.core.command.Command) ButtonClickEvent(net.dv8tion.jda.api.events.interaction.ButtonClickEvent) Permission(net.dv8tion.jda.api.Permission) CommandId(com.sx4.bot.annotations.command.CommandId) TextChannel(net.dv8tion.jda.api.entities.TextChannel) ErrorResponse(net.dv8tion.jda.api.requests.ErrorResponse) PagedResult(com.sx4.bot.paged.PagedResult) User(net.dv8tion.jda.api.entities.User) ArrayList(java.util.ArrayList) Bson(org.bson.conversions.Bson) Alternative(com.sx4.bot.entities.argument.Alternative) Pair(net.dv8tion.jda.internal.utils.tuple.Pair) ButtonUtility(com.sx4.bot.utility.ButtonUtility) Sx4CommandEvent(com.sx4.bot.core.Sx4CommandEvent) Button(net.dv8tion.jda.api.interactions.components.Button) AlternativeOptions(com.sx4.bot.annotations.argument.AlternativeOptions) Reason(com.sx4.bot.entities.mod.Reason) Waiter(com.sx4.bot.waiter.Waiter) GenericEvent(net.dv8tion.jda.api.events.GenericEvent) com.mongodb.client.model(com.mongodb.client.model) Range(com.sx4.bot.entities.argument.Range) Argument(com.jockie.bot.core.argument.Argument) Action(com.sx4.bot.entities.mod.action.Action) AuthorPermissions(com.sx4.bot.annotations.command.AuthorPermissions) Operators(com.sx4.bot.database.mongo.model.Operators) ErrorResponseException(net.dv8tion.jda.api.exceptions.ErrorResponseException) Sx4Command(com.sx4.bot.core.Sx4Command) CompletionException(java.util.concurrent.CompletionException) TimeoutException(com.sx4.bot.waiter.exception.TimeoutException) Premium(com.sx4.bot.annotations.command.Premium) ModuleCategory(com.sx4.bot.category.ModuleCategory) ModLog(com.sx4.bot.entities.mod.ModLog) List(java.util.List) Examples(com.sx4.bot.annotations.command.Examples) ImageUrl(com.sx4.bot.annotations.argument.ImageUrl) ObjectId(org.bson.types.ObjectId) ExceptionUtility(com.sx4.bot.utility.ExceptionUtility) User(net.dv8tion.jda.api.entities.User) Document(org.bson.Document) PagedResult(com.sx4.bot.paged.PagedResult) Bson(org.bson.conversions.Bson) Command(com.jockie.bot.core.command.Command) Sx4Command(com.sx4.bot.core.Sx4Command) CommandId(com.sx4.bot.annotations.command.CommandId) Examples(com.sx4.bot.annotations.command.Examples)

Example 3 with Action

use of com.sx4.bot.entities.mod.action.Action in project Sx4 by sx4-discord-bot.

the class ColourCommand method onCommand.

public void onCommand(Sx4CommandEvent event, @Argument(value = "colour", endless = true) @DefaultNumber(-1) @Colour int colour) {
    if (colour == -1) {
        colour = event.getRandom().nextInt(0xFFFFFF + 1);
    }
    String hex = "#" + ColourUtility.toHexString(colour);
    MessageEmbed embed = new EmbedBuilder().setColor(ImageUtility.getEmbedColour(colour)).setAuthor(hex, null, "attachment://image.png").setDescription(String.format("Hex: %s\nRGB: %s", hex, ColourUtility.toRGBString(colour))).setImage("attachment://image.png").build();
    Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("colour")).addQuery("colour", colour).build(event.getConfig().getImageWebserver());
    event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> {
        MessageAction action = ImageUtility.getImageMessage(event, response);
        if (response.isSuccessful()) {
            action.setEmbeds(embed);
        }
        action.queue();
    });
}
Also used : Request(okhttp3.Request) ImageRequest(com.sx4.bot.entities.image.ImageRequest) HttpCallback(com.sx4.bot.http.HttpCallback) ImageUtility(com.sx4.bot.utility.ImageUtility) Sx4Command(com.sx4.bot.core.Sx4Command) Permission(net.dv8tion.jda.api.Permission) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) Colour(com.sx4.bot.annotations.argument.Colour) ModuleCategory(com.sx4.bot.category.ModuleCategory) ColourUtility(com.sx4.bot.utility.ColourUtility) DefaultNumber(com.sx4.bot.annotations.argument.DefaultNumber) Sx4CommandEvent(com.sx4.bot.core.Sx4CommandEvent) MessageAction(net.dv8tion.jda.api.requests.restaction.MessageAction) MessageEmbed(net.dv8tion.jda.api.entities.MessageEmbed) Argument(com.jockie.bot.core.argument.Argument) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) MessageEmbed(net.dv8tion.jda.api.entities.MessageEmbed) ImageRequest(com.sx4.bot.entities.image.ImageRequest) MessageAction(net.dv8tion.jda.api.requests.restaction.MessageAction) Request(okhttp3.Request) ImageRequest(com.sx4.bot.entities.image.ImageRequest)

Example 4 with Action

use of com.sx4.bot.entities.mod.action.Action in project Sx4 by sx4-discord-bot.

the class ModUtility method performAction.

public static CompletableFuture<? extends Action> performAction(Sx4 bot, Action action, Member target, Member moderator, Reason reason) {
    Guild guild = target.getGuild();
    switch(action.getModAction()) {
        case WARN:
            return ModUtility.warn(bot, target, moderator, reason);
        case MUTE:
        case MUTE_EXTEND:
            if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
                return CompletableFuture.failedFuture(new BotPermissionException(Permission.MANAGE_ROLES));
            }
            return ModUtility.mute(bot, target, moderator, Duration.ofSeconds(((TimeAction) action).getDuration()), action.getModAction().isExtend(), reason);
        case KICK:
            if (!guild.getSelfMember().hasPermission(Permission.KICK_MEMBERS)) {
                return CompletableFuture.failedFuture(new BotPermissionException(Permission.KICK_MEMBERS));
            }
            if (!guild.getSelfMember().canInteract(target)) {
                return CompletableFuture.failedFuture(new BotHierarchyException("kick"));
            }
            if (!moderator.hasPermission(Permission.KICK_MEMBERS)) {
                return CompletableFuture.failedFuture(new AuthorPermissionException(Permission.KICK_MEMBERS));
            }
            return target.kick(ModUtility.getAuditReason(reason, moderator.getUser())).submit().thenApply($ -> {
                bot.getModActionManager().onModAction(new KickEvent(moderator, target.getUser(), reason));
                return action;
            });
        case TEMPORARY_BAN:
            if (!guild.getSelfMember().hasPermission(Permission.BAN_MEMBERS)) {
                return CompletableFuture.failedFuture(new BotPermissionException(Permission.BAN_MEMBERS));
            }
            if (!guild.getSelfMember().canInteract(target)) {
                return CompletableFuture.failedFuture(new BotHierarchyException("ban"));
            }
            if (!moderator.hasPermission(Permission.BAN_MEMBERS)) {
                return CompletableFuture.failedFuture(new AuthorPermissionException(Permission.BAN_MEMBERS));
            }
            long temporaryBanDuration = ((TimeAction) action).getDuration();
            List<Bson> temporaryBanUpdate = List.of(Operators.set("unbanAt", Operators.add(Operators.nowEpochSecond(), temporaryBanDuration)));
            Bson filter = Filters.and(Filters.eq("userId", target.getIdLong()), Filters.eq("guildId", guild.getIdLong()));
            return bot.getMongo().updateTemporaryBan(filter, temporaryBanUpdate, new UpdateOptions().upsert(true)).thenCompose(temporaryBanResult -> target.ban(1).reason(ModUtility.getAuditReason(reason, moderator.getUser())).submit()).thenApply($ -> {
                bot.getModActionManager().onModAction(new TemporaryBanEvent(moderator, target.getUser(), reason, true, temporaryBanDuration));
                bot.getTemporaryBanManager().putBan(guild.getIdLong(), target.getIdLong(), temporaryBanDuration);
                return action;
            });
        case BAN:
            if (!guild.getSelfMember().hasPermission(Permission.BAN_MEMBERS)) {
                return CompletableFuture.failedFuture(new BotPermissionException(Permission.BAN_MEMBERS));
            }
            if (!guild.getSelfMember().canInteract(target)) {
                return CompletableFuture.failedFuture(new BotHierarchyException("ban"));
            }
            if (!moderator.hasPermission(Permission.BAN_MEMBERS)) {
                return CompletableFuture.failedFuture(new AuthorPermissionException(Permission.BAN_MEMBERS));
            }
            return target.ban(1).reason(ModUtility.getAuditReason(reason, moderator.getUser())).submit().thenApply($ -> {
                bot.getModActionManager().onModAction(new BanEvent(moderator, target.getUser(), reason, true));
                return action;
            });
        default:
            return CompletableFuture.completedFuture(null);
    }
}
Also used : Document(org.bson.Document) Operators(com.sx4.bot.database.mongo.model.Operators) BotPermissionException(com.sx4.bot.exceptions.mod.BotPermissionException) com.sx4.bot.entities.mod.action(com.sx4.bot.entities.mod.action) Permission(net.dv8tion.jda.api.Permission) MongoDatabase(com.sx4.bot.database.mongo.MongoDatabase) CompletableFuture(java.util.concurrent.CompletableFuture) MaxRolesException(com.sx4.bot.exceptions.mod.MaxRolesException) Member(net.dv8tion.jda.api.entities.Member) AuthorPermissionException(com.sx4.bot.exceptions.mod.AuthorPermissionException) BotHierarchyException(com.sx4.bot.exceptions.mod.BotHierarchyException) AtomicReference(java.util.concurrent.atomic.AtomicReference) User(net.dv8tion.jda.api.entities.User) Bson(org.bson.conversions.Bson) List(java.util.List) Guild(net.dv8tion.jda.api.entities.Guild) Sx4(com.sx4.bot.core.Sx4) Role(net.dv8tion.jda.api.entities.Role) Duration(java.time.Duration) Reason(com.sx4.bot.entities.mod.Reason) Clock(java.time.Clock) com.sx4.bot.events.mod(com.sx4.bot.events.mod) com.mongodb.client.model(com.mongodb.client.model) Collections(java.util.Collections) Guild(net.dv8tion.jda.api.entities.Guild) Bson(org.bson.conversions.Bson) BotPermissionException(com.sx4.bot.exceptions.mod.BotPermissionException) BotHierarchyException(com.sx4.bot.exceptions.mod.BotHierarchyException) AuthorPermissionException(com.sx4.bot.exceptions.mod.AuthorPermissionException)

Example 5 with Action

use of com.sx4.bot.entities.mod.action.Action in project Sx4 by sx4-discord-bot.

the class ModUtility method warn.

public static CompletableFuture<WarnAction> warn(Sx4 bot, Member target, Member moderator, Reason reason) {
    CompletableFuture<WarnAction> future = new CompletableFuture<>();
    Guild guild = target.getGuild();
    Document data = bot.getMongo().getGuildById(guild.getIdLong(), Projections.include("warn", "mute", "temporaryBan", "fakePermissions"));
    List<Document> fakePermissions = data.getEmbedded(List.of("fakePermissions", "holders"), Collections.emptyList());
    Document warnData = data.get("warn", MongoDatabase.EMPTY_DOCUMENT);
    List<Document> config = warnData.getList("config", Document.class, Warn.DEFAULT_CONFIG);
    boolean punishments = warnData.getBoolean("punishments", true);
    Document reset = warnData.get("reset", Document.class);
    int maxWarning = punishments ? config.stream().map(d -> d.getInteger("number")).max(Integer::compareTo).get() : Integer.MAX_VALUE;
    List<Bson> update = List.of(Operators.set("warnings", Operators.let(new Document("warnings", Operators.ifNull("$warnings", 0)), Operators.mod(Operators.cond(Operators.exists("$reset"), Operators.max(1, Operators.add(1, Operators.subtract("$$warnings", Operators.multiply(Operators.toInt(Operators.floor(Operators.divide(Operators.subtract(Operators.nowEpochSecond(), "$lastWarning"), "$reset.after"))), "$reset.amount")))), Operators.add("$$warnings", 1)), maxWarning))), Operators.set("lastWarning", Operators.nowEpochSecond()), reset == null ? Operators.unset("reset") : Operators.set("reset", reset));
    FindOneAndUpdateOptions options = new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER).projection(Projections.include("warnings")).upsert(true);
    Bson filter = Filters.and(Filters.eq("userId", target.getIdLong()), Filters.eq("guildId", guild.getIdLong()));
    bot.getMongo().findAndUpdateWarnings(filter, update, options).whenComplete((result, exception) -> {
        if (exception != null) {
            future.completeExceptionally(exception);
            return;
        }
        int warnings = result.getInteger("warnings");
        Action warnAction = new Action(ModAction.WARN);
        Action currentAction = warnAction, nextAction = warnAction;
        if (punishments) {
            for (Document configData : config) {
                int number = configData.getInteger("number");
                if (number == warnings) {
                    currentAction = Action.fromData(configData.get("action", Document.class));
                } else if (number == warnings + 1) {
                    nextAction = Action.fromData(configData.get("action", Document.class));
                }
            }
        }
        Action action = currentAction;
        Warn currentWarning = new Warn(action, warnings);
        Warn nextWarning = new Warn(nextAction, warnings + 1);
        switch(action.getModAction()) {
            case WARN:
                bot.getModActionManager().onModAction(new WarnEvent(moderator, target.getUser(), reason, currentWarning, nextWarning));
                future.complete(new WarnAction(currentWarning));
                break;
            case MUTE_EXTEND:
            case MUTE:
                if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
                    future.completeExceptionally(new BotPermissionException(Permission.MANAGE_ROLES));
                    return;
                }
                AtomicReference<Role> atomicRole = new AtomicReference<>();
                Document mute = data.get("mute", MongoDatabase.EMPTY_DOCUMENT);
                long muteDuration = ((TimeAction) action).getDuration();
                boolean extend = action.getModAction().isExtend();
                ModUtility.upsertMuteRole(bot.getMongo(), guild, mute.get("roleId", 0L), mute.get("autoUpdate", true)).thenCompose(role -> {
                    atomicRole.set(role);
                    List<Bson> muteUpdate = List.of(Operators.set("unmuteAt", Operators.add(muteDuration, Operators.cond(Operators.and(extend, Operators.exists("$unmuteAt")), "$unmuteAt", Operators.nowEpochSecond()))));
                    Bson muteFilter = Filters.and(Filters.eq("userId", target.getIdLong()), Filters.eq("guildId", guild.getIdLong()));
                    return bot.getMongo().updateMute(muteFilter, muteUpdate, new UpdateOptions().upsert(true));
                }).whenComplete((muteResult, muteException) -> {
                    if (muteException != null) {
                        future.completeExceptionally(muteException);
                        return;
                    }
                    Role role = atomicRole.get();
                    guild.addRoleToMember(target, role).reason(ModUtility.getAuditReason(reason, moderator.getUser())).queue($ -> {
                        bot.getMuteManager().putMute(guild.getIdLong(), target.getIdLong(), role.getIdLong(), muteDuration, extend && muteResult.getUpsertedId() == null);
                        bot.getModActionManager().onModAction(new WarnEvent(moderator, target.getUser(), reason, currentWarning, nextWarning));
                        future.complete(new WarnAction(currentWarning));
                    });
                });
                break;
            case KICK:
                if (!guild.getSelfMember().hasPermission(Permission.KICK_MEMBERS)) {
                    future.completeExceptionally(new BotPermissionException(Permission.KICK_MEMBERS));
                    return;
                }
                if (!guild.getSelfMember().canInteract(target)) {
                    future.completeExceptionally(new BotHierarchyException("kick"));
                    return;
                }
                if (!CheckUtility.hasPermissions(bot, moderator, fakePermissions, Permission.KICK_MEMBERS)) {
                    future.completeExceptionally(new AuthorPermissionException(Permission.KICK_MEMBERS));
                    return;
                }
                target.kick(ModUtility.getAuditReason(reason, moderator.getUser())).queue($ -> {
                    bot.getModActionManager().onModAction(new WarnEvent(moderator, target.getUser(), reason, currentWarning, nextWarning));
                    future.complete(new WarnAction(currentWarning));
                });
                break;
            case TEMPORARY_BAN:
                if (!guild.getSelfMember().hasPermission(Permission.BAN_MEMBERS)) {
                    future.completeExceptionally(new BotPermissionException(Permission.BAN_MEMBERS));
                    return;
                }
                if (!guild.getSelfMember().canInteract(target)) {
                    future.completeExceptionally(new BotHierarchyException("ban"));
                    return;
                }
                if (!CheckUtility.hasPermissions(bot, moderator, fakePermissions, Permission.BAN_MEMBERS)) {
                    future.completeExceptionally(new AuthorPermissionException(Permission.BAN_MEMBERS));
                    return;
                }
                long temporaryBanDuration = ((TimeAction) action).getDuration();
                Bson temporaryBanUpdate = Updates.set("unbanAt", Clock.systemUTC().instant().getEpochSecond() + temporaryBanDuration);
                Bson temporaryBanFilter = Filters.and(Filters.eq("userId", target.getIdLong()), Filters.eq("guildId", guild.getIdLong()));
                bot.getMongo().updateTemporaryBan(temporaryBanFilter, temporaryBanUpdate, new UpdateOptions().upsert(true)).whenComplete((temporaryBanResult, temporaryBanException) -> {
                    if (temporaryBanException != null) {
                        future.completeExceptionally(temporaryBanException);
                        return;
                    }
                    target.ban(1).reason(ModUtility.getAuditReason(reason, moderator.getUser())).queue($ -> {
                        bot.getModActionManager().onModAction(new WarnEvent(moderator, target.getUser(), reason, currentWarning, nextWarning));
                        bot.getTemporaryBanManager().putBan(guild.getIdLong(), target.getIdLong(), ((TimeAction) action).getDuration());
                        future.complete(new WarnAction(currentWarning));
                    });
                });
                break;
            case BAN:
                if (!guild.getSelfMember().hasPermission(Permission.BAN_MEMBERS)) {
                    future.completeExceptionally(new BotPermissionException(Permission.BAN_MEMBERS));
                    return;
                }
                if (!guild.getSelfMember().canInteract(target)) {
                    future.completeExceptionally(new BotHierarchyException("ban"));
                    return;
                }
                if (!CheckUtility.hasPermissions(bot, moderator, fakePermissions, Permission.BAN_MEMBERS)) {
                    future.completeExceptionally(new AuthorPermissionException(Permission.BAN_MEMBERS));
                    return;
                }
                target.ban(1).reason(ModUtility.getAuditReason(reason, moderator.getUser())).queue($ -> {
                    bot.getModActionManager().onModAction(new WarnEvent(moderator, target.getUser(), reason, currentWarning, nextWarning));
                    future.complete(new WarnAction(currentWarning));
                });
                break;
            default:
                break;
        }
    });
    return future;
}
Also used : Document(org.bson.Document) Operators(com.sx4.bot.database.mongo.model.Operators) BotPermissionException(com.sx4.bot.exceptions.mod.BotPermissionException) com.sx4.bot.entities.mod.action(com.sx4.bot.entities.mod.action) Permission(net.dv8tion.jda.api.Permission) MongoDatabase(com.sx4.bot.database.mongo.MongoDatabase) CompletableFuture(java.util.concurrent.CompletableFuture) MaxRolesException(com.sx4.bot.exceptions.mod.MaxRolesException) Member(net.dv8tion.jda.api.entities.Member) AuthorPermissionException(com.sx4.bot.exceptions.mod.AuthorPermissionException) BotHierarchyException(com.sx4.bot.exceptions.mod.BotHierarchyException) AtomicReference(java.util.concurrent.atomic.AtomicReference) User(net.dv8tion.jda.api.entities.User) Bson(org.bson.conversions.Bson) List(java.util.List) Guild(net.dv8tion.jda.api.entities.Guild) Sx4(com.sx4.bot.core.Sx4) Role(net.dv8tion.jda.api.entities.Role) Duration(java.time.Duration) Reason(com.sx4.bot.entities.mod.Reason) Clock(java.time.Clock) com.sx4.bot.events.mod(com.sx4.bot.events.mod) com.mongodb.client.model(com.mongodb.client.model) Collections(java.util.Collections) Guild(net.dv8tion.jda.api.entities.Guild) Document(org.bson.Document) Bson(org.bson.conversions.Bson) CompletableFuture(java.util.concurrent.CompletableFuture) BotPermissionException(com.sx4.bot.exceptions.mod.BotPermissionException) List(java.util.List) BotHierarchyException(com.sx4.bot.exceptions.mod.BotHierarchyException) AuthorPermissionException(com.sx4.bot.exceptions.mod.AuthorPermissionException) AtomicReference(java.util.concurrent.atomic.AtomicReference) Role(net.dv8tion.jda.api.entities.Role)

Aggregations

Sx4Command (com.sx4.bot.core.Sx4Command)9 Permission (net.dv8tion.jda.api.Permission)8 Document (org.bson.Document)8 Bson (org.bson.conversions.Bson)8 User (net.dv8tion.jda.api.entities.User)7 Argument (com.jockie.bot.core.argument.Argument)6 Command (com.jockie.bot.core.command.Command)6 CommandId (com.sx4.bot.annotations.command.CommandId)6 ModuleCategory (com.sx4.bot.category.ModuleCategory)6 Sx4CommandEvent (com.sx4.bot.core.Sx4CommandEvent)6 com.mongodb.client.model (com.mongodb.client.model)5 Examples (com.sx4.bot.annotations.command.Examples)5 Operators (com.sx4.bot.database.mongo.model.Operators)5 List (java.util.List)5 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)5 AuthorPermissions (com.sx4.bot.annotations.command.AuthorPermissions)4 MongoDatabase (com.sx4.bot.database.mongo.MongoDatabase)4 Action (com.sx4.bot.entities.mod.action.Action)4 PagedResult (com.sx4.bot.paged.PagedResult)4 Reason (com.sx4.bot.entities.mod.Reason)3