net.dv8tion.jda.api.events.guild.voice.GuildVoiceJoinEvent Java Examples

The following examples show how to use net.dv8tion.jda.api.events.guild.voice.GuildVoiceJoinEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuildListener.java    From SkyBot with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void onEvent(@Nonnull GenericEvent event) {
    if (event instanceof GuildJoinEvent) {
        this.onGuildJoin((GuildJoinEvent) event);
    } else if (event instanceof GuildLeaveEvent) {
        this.onGuildLeave((GuildLeaveEvent) event);
    } else if (event instanceof GuildVoiceLeaveEvent) {
        this.onGuildVoiceLeave((GuildVoiceLeaveEvent) event);
    } else if (event instanceof GuildVoiceJoinEvent) {
        this.onGuildVoiceJoin((GuildVoiceJoinEvent) event);
    } else if (event instanceof GuildVoiceMoveEvent) {
        this.onGuildVoiceMove((GuildVoiceMoveEvent) event);
    } else if (event instanceof GuildBanEvent) {
        this.onGuildBan((GuildBanEvent) event);
    } else if (event instanceof GuildUnbanEvent) {
        this.onGuildUnban((GuildUnbanEvent) event);
    }
}
 
Example #2
Source File: EntranceSoundBoardListener.java    From DiscordSoundboard with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"rawtypes"})
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if (!event.getMember().getUser().isBot()) {
        String userJoined = event.getMember().getEffectiveName();
        String userId = event.getMember().getId();

        User user = userRepository.findOneByIdOrUsernameIgnoreCase(userId, userJoined);
        if (user != null && !StringUtils.isNullOrEmpty(user.getEntranceSound())) {
            bot.playFileInChannel(user.getEntranceSound(), event.getChannelJoined());
        } else {
            //If DB doesn't have an entrance sound check for a file.
            String entranceFile = bot.getFileForUser(userJoined, true);
            if (!entranceFile.equals("")) {
                try {
                    bot.playFileInChannel(entranceFile, event.getChannelJoined());
                } catch (Exception e) {
                    LOG.fatal("Could not play file for entrance of " + userJoined);
                }

            } else {

                LOG.debug("Could not find any sound that starts with " + userJoined + ", so ignoring entrance.");
            }
        }
    }
}
 
Example #3
Source File: GuildListener.java    From SkyBot with GNU Affero General Public License v3.0 5 votes vote down vote up
private void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    final Guild guild = event.getGuild();
    final Member member = event.getMember();
    final Member self = guild.getSelfMember();
    final VoiceChannel channel = event.getChannelJoined();

    if (member.equals(self)) {
        channelCheckThing(guild, channel);
    }

    handleVcAutoRole(guild, member, channel, false);
}
 
Example #4
Source File: MemberListener.java    From JuniperBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Transactional
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if (!event.getMember().getUser().isBot()) {
        getAuditService().log(event.getGuild(), AuditActionType.VOICE_JOIN)
                .withUser(event.getMember())
                .withChannel(event.getChannelJoined())
                .save();
    }
}
 
Example #5
Source File: VoiceLinkListener.java    From JuniperBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    GuildConfig config = getApplicableConfig(event);
    if (config == null) {
        return;
    }
    Role role = getRole(config, event.getChannelJoined());
    if (role != null) {
        event.getGuild().addRoleToMember(event.getMember(), role).queue();
    }
}
 
Example #6
Source File: VoiceChannelListener.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onEvent(@NotNull GenericEvent event) {
    if (event instanceof GuildVoiceMoveEvent) {
        onGuildVoiceMove((GuildVoiceMoveEvent) event);
    } else if (event instanceof GuildVoiceJoinEvent) {
        onGuildVoiceJoin((GuildVoiceJoinEvent) event);
    } else if (event instanceof GuildVoiceLeaveEvent) {
        onGuildVoiceLeave((GuildVoiceLeaveEvent) event);
    } else if (event instanceof GuildVoiceMuteEvent) {
        onGuildVoiceMute((GuildVoiceMuteEvent) event);
    }
}
 
Example #7
Source File: VoiceModule.java    From DiscordSRV with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    checkMutedUser(event.getChannelJoined(), event.getMember());
    if (!event.getChannelJoined().equals(getLobbyChannel())) return;

    UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getUser().getId());
    if (uuid == null) return;
    OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
    if (player.isOnline()) markDirty(player.getPlayer());
}
 
Example #8
Source File: GuildAudioListener.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    tryAutoPlay(event.getMember(), event.getGuild(), event.getChannelJoined());
}
 
Example #9
Source File: VoiceChannelListener.java    From MantaroBot with GNU General Public License v3.0 4 votes vote down vote up
private void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if (event.getChannelJoined().getMembers().contains(event.getGuild().getSelfMember()))
        onJoin(event.getChannelJoined());
}