Search in sources :

Example 1 with GuildMessageEmbedEvent

use of net.dv8tion.jda.api.events.message.guild.GuildMessageEmbedEvent in project pokeraidbot by magnusmickelsson.

the class EventLoggingListener method onEvent.

@Override
public void onEvent(GenericEvent event) {
    if (LOGGER.isTraceEnabled()) {
        if (event instanceof GuildMessageReactionAddEvent) {
            final GuildMessageReactionAddEvent reactionAddEvent = (GuildMessageReactionAddEvent) event;
            LOGGER.trace("Reaction: " + reactionAddEvent.getUser() + " - " + reactionAddEvent.getReaction() + " - " + reactionAddEvent.getReactionEmote());
        } else if (event instanceof GuildMessageReceivedEvent) {
            final GuildMessageReceivedEvent guildMessageReceivedEvent = (GuildMessageReceivedEvent) event;
            LOGGER.trace("Message from " + guildMessageReceivedEvent.getAuthor() + ": " + guildMessageReceivedEvent.getMessage());
        } else if (event instanceof GuildMessageEmbedEvent) {
            final GuildMessageEmbedEvent guildMessageReceivedEvent = (GuildMessageEmbedEvent) event;
            final List<MessageEmbed> messageEmbeds = guildMessageReceivedEvent.getMessageEmbeds();
            for (MessageEmbed embed : messageEmbeds) LOGGER.trace("Embed message from " + embed.getAuthor() + ": " + String.valueOf(embed.getTitle()) + " - " + String.valueOf(embed.getDescription()));
        }
    }
}
Also used : MessageEmbed(net.dv8tion.jda.api.entities.MessageEmbed) GuildMessageReactionAddEvent(net.dv8tion.jda.api.events.message.guild.react.GuildMessageReactionAddEvent) GuildMessageEmbedEvent(net.dv8tion.jda.api.events.message.guild.GuildMessageEmbedEvent) GuildMessageReceivedEvent(net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent)

Aggregations

MessageEmbed (net.dv8tion.jda.api.entities.MessageEmbed)1 GuildMessageEmbedEvent (net.dv8tion.jda.api.events.message.guild.GuildMessageEmbedEvent)1 GuildMessageReceivedEvent (net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent)1 GuildMessageReactionAddEvent (net.dv8tion.jda.api.events.message.guild.react.GuildMessageReactionAddEvent)1