All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.internal.parameters.resolvers.MessageResolver Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.18
Show newest version
package io.github.freya022.botcommands.internal.parameters.resolvers;

import io.github.freya022.botcommands.api.commands.application.context.message.options.MessageContextCommandOption;
import io.github.freya022.botcommands.api.core.service.annotations.Resolver;
import io.github.freya022.botcommands.api.parameters.ClassParameterResolver;
import io.github.freya022.botcommands.api.parameters.resolvers.MessageContextParameterResolver;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Resolver
public class MessageResolver
        extends ClassParameterResolver
        implements MessageContextParameterResolver {

    public MessageResolver() {
        super(Message.class);
    }

    @Nullable
    @Override
    public Message resolve(@NotNull MessageContextCommandOption option, @NotNull MessageContextInteractionEvent event) {
        return event.getTarget();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy