net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent Java Examples
The following examples show how to use
net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent.
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 |
@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: GuildListener.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
private void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { final Guild guild = event.getGuild(); final LavalinkManager manager = LavalinkManager.ins; handleVcAutoRole(guild, event.getMember(), event.getChannelLeft(), true); if (!manager.isConnected(guild)) { return; } if (event.getMember().equals(guild.getSelfMember())) { return; } final VoiceChannel vc = manager.getConnectedChannel(guild); if (vc == null) { return; } if (!event.getChannelLeft().equals(vc)) { return; } channelCheckThing(guild, event.getChannelLeft()); }
Example #3
Source File: LeaveSoundBoardListener.java From DiscordSoundboard with Apache License 2.0 | 6 votes |
@SuppressWarnings({"rawtypes"}) public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { String userDisconnected = event.getMember().getEffectiveName(); String userDisconnectedId = event.getMember().getId(); User user = userRepository.findOneByIdOrUsernameIgnoreCase(userDisconnectedId, userDisconnected); if (user != null && !StringUtils.isNullOrEmpty(user.getLeaveSound())) { bot.playFileInChannel(user.getLeaveSound(), event.getChannelJoined()); } else { //If DB doesn't have a leave sound check for a file String fileToPlay = bot.getFileForUser(userDisconnected, false); if (!fileToPlay.equals("")) { try { bot.playFileInChannel(fileToPlay, event.getChannelLeft()); } catch (Exception e) { LOG.fatal("Could not play file for disconnection of " + userDisconnected); } } else { LOG.debug("Could not find disconnection sound for " + userDisconnected + ", so ignoring disconnection event."); } } }
Example #4
Source File: MemberListener.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
@Override @Transactional public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { if (!event.getMember().getUser().isBot()) { getAuditService().log(event.getGuild(), AuditActionType.VOICE_LEAVE) .withUser(event.getMember()) .withChannel(event.getChannelLeft()) .save(); } }
Example #5
Source File: VoiceLinkListener.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
@Override public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { GuildConfig config = getApplicableConfig(event); if (config == null) { return; } Role role = getRole(config, event.getChannelLeft()); if (role != null) { event.getGuild().removeRoleFromMember(event.getMember(), role).queue(); } }
Example #6
Source File: VoiceChannelListener.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
@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 |
@Override public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { checkMutedUser(event.getChannelJoined(), event.getMember()); if (event.getChannelLeft().getParent() == null || !event.getChannelLeft().getParent().equals(getCategory())) return; UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getUser().getId()); if (uuid == null) return; OfflinePlayer player = Bukkit.getOfflinePlayer(uuid); if (player.isOnline()) { networks.stream() .filter(network -> network.getPlayers().contains(player.getPlayer())) .forEach(network -> network.disconnect(player.getPlayer())); } }
Example #8
Source File: VoiceChannelListener.java From MantaroBot with GNU General Public License v3.0 | 4 votes |
private void onGuildVoiceLeave(GuildVoiceLeaveEvent event) { if (event.getChannelLeft().getMembers().contains(event.getGuild().getSelfMember())) onLeave(event.getChannelLeft()); }