src/main/java/me/evyn/bot/listeners/ActivityListener.java
@Override
    public void onGuildMemberUpdateNickname(GuildMemberUpdateNicknameEvent event) {
        long guildId = event.getGuild().getIdLong();

        TextChannel actLogChannel = ActivityLogs.getActivityChannel(event, guildId);

        if (actLogChannel != null) {
            String oldNickname = event.getOldNickname();
            if (oldNickname == null) {
                oldNickname = event.getUser().getName();
            }
            String newNickname = event.getNewNickname();
            if (newNickname == null) {
                newNickname = event.getUser().getName();
            }

            boolean embed = DataSourceCollector.getGuildEmbed(guildId);
            if (embed) {
                EmbedBuilder eb = new EmbedBuilder();
                eb.setAuthor(event.getUser().getAsTag() + " (" + event.getUser().getId() + ")",
                        event.getUser().getAvatarUrl(), event.getUser().getAvatarUrl())
                        .setDescription("Updated their nickname from: **" + oldNickname + "**" + "\n"
                        + "to: **" + newNickname + "**")
                        .setColor(0xFFFF00)
                        .setFooter("Nickname update.")
                        .setTimestamp(Instant.now());

                actLogChannel.sendMessage(eb.build()).queue();
            } else {
                actLogChannel.sendMessage("User " + event.getUser().getAsTag() + "(" +
                        event.getUser().getId() + ") changed their nickname from: **" + oldNickname + "** to: **" +
                        newNickname + "**").queue();
            }
        }
    }
/**
     * If activity logs are enabled, sends log on guild member nickname change
     * @param event GuildMemberUpdateNicknameEvent
     */
If activity logs are enabled, sends log on guild member nickname change
@param event GuildMemberUpdateNicknameEvent
If activity logs are enabled sends log on guild member nickname change @param event GuildMemberUpdateNicknameEvent
@Override
    public void onGuildMemberUpdateNickname(GuildMemberUpdateNicknameEvent event) {
        long guildId = event.getGuild().getIdLong();
        TextChannel actLogChannel = ActivityLogs.getActivityChannel(event, guildId);
        if (actLogChannel != null) {
            String oldNickname = event.getOldNickname();
            if (oldNickname == null) {
                oldNickname = event.getUser().getName();
            }
            String newNickname = event.getNewNickname();
            if (newNickname == null) {
                newNickname = event.getUser().getName();
            }
            boolean embed = DataSourceCollector.getGuildEmbed(guildId);
            if (embed) {
                EmbedBuilder eb = new EmbedBuilder();
                eb.setAuthor(event.getUser().getAsTag() + " (" + event.getUser().getId() + ")",
                        event.getUser().getAvatarUrl(), event.getUser().getAvatarUrl())
                        .setDescription("Updated their nickname from: **" + oldNickname + "**" + "\n"
                        + "to: **" + newNickname + "**")
                        .setColor(0xFFFF00)
                        .setFooter("Nickname update.")
                        .setTimestamp(Instant.now());
                actLogChannel.sendMessage(eb.build()).queue();
            } else {
                actLogChannel.sendMessage("User " + event.getUser().getAsTag() + "(" +
                        event.getUser().getId() + ") changed their nickname from: **" + oldNickname + "** to: **" +
                        newNickname + "**").queue();
            }
        }
    }
@ Override public void onGuildMemberUpdateNickname ( GuildMemberUpdateNicknameEvent event ) { long guildId = event . getGuild ( ) . getIdLong ( ) ; TextChannel actLogChannel = ActivityLogs . getActivityChannel ( event , guildId ) ; if ( actLogChannel != null ) { String oldNickname = event . getOldNickname ( ) ; if ( oldNickname == null ) { oldNickname = event . getUser ( ) . getName ( ) ; } String newNickname = event . getNewNickname ( ) ; if ( newNickname == null ) { newNickname = event . getUser ( ) . getName ( ) ; } boolean embed = DataSourceCollector . getGuildEmbed ( guildId ) ; if ( embed ) { EmbedBuilder eb = new EmbedBuilder ( ) ; eb . setAuthor ( event . getUser ( ) . getAsTag ( ) + " (" + event . getUser ( ) . getId ( ) + ")" , event . getUser ( ) . getAvatarUrl ( ) , event . getUser ( ) . getAvatarUrl ( ) ) . setDescription ( "Updated their nickname from: **" + oldNickname + "**" + "\n" + "to: **" + newNickname + "**" ) . setColor ( 0xFFFF00 ) . setFooter ( "Nickname update." ) . setTimestamp ( Instant . now ( ) ) ; actLogChannel . sendMessage ( eb . build ( ) ) . queue ( ) ; } else { actLogChannel . sendMessage ( "User " + event . getUser ( ) . getAsTag ( ) + "(" + event . getUser ( ) . getId ( ) + ") changed their nickname from: **" + oldNickname + "** to: **" + newNickname + "**" ) . queue ( ) ; } } }
If activity logs are enabled, sends log on guild member nickname change
 @param event GuildMemberUpdateNicknameEvent
If activity logs are enabled sends log on guild member nickname change @param event GuildMemberUpdateNicknameEvent