net.dv8tion.jda.api.events.guild.GuildLeaveEvent Java Examples

The following examples show how to use net.dv8tion.jda.api.events.guild.GuildLeaveEvent. 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: MantaroListener.java    From MantaroBot with GNU General Public License v3.0 6 votes vote down vote up
private void onLeave(GuildLeaveEvent event) {
    try {
        final JDA jda = event.getJDA();
        final MantaroObj mantaroData = MantaroData.db().getMantaroData();

        if (mantaroData.getBlackListedGuilds().contains(event.getGuild().getId()) ||
                mantaroData.getBlackListedUsers().contains(event.getGuild().getOwner().getUser().getId())) {
            log.info("Left " + event.getGuild() + " because of a blacklist entry. (O:" + event.getGuild().getOwner() + ")");
            return;
        }

        //Post bot statistics to the main API.
        this.postStats(jda);

        Metrics.GUILD_ACTIONS.labels("leave").inc();
        MantaroBot.getInstance().getAudioManager().getMusicManagers().remove(event.getGuild().getId());
        GuildStatsManager.log(LoggedEvent.LEAVE);
    } catch (Exception e) {
        if (!(e instanceof NullPointerException) && !(e instanceof IllegalArgumentException)) {
            SentryHelper.captureException("Unexpected error while logging an event", e, this.getClass());
        }
    }
}
 
Example #3
Source File: GuildListener.java    From SkyBot with GNU Affero General Public License v3.0 5 votes vote down vote up
private void onGuildLeave(GuildLeaveEvent event) {
    final Guild guild = event.getGuild();

    variables.getAudioUtils().removeMusicManager(guild);

    logger.info("{}Leaving guild: {} ({}).{}",
        TextColor.RED,
        guild.getName(),
        guild.getId(),
        TextColor.RESET
    );
}
 
Example #4
Source File: GuildAudioListener.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    playerService.stop(null, event.getGuild());
}
 
Example #5
Source File: MafiaListener.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    mafiaService.stop(event.getGuild());
}
 
Example #6
Source File: GuildListener.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    coolDownService.clear(event.getGuild());
}
 
Example #7
Source File: StatisticsListener.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
public void onGuildLeave(GuildLeaveEvent event) {
    statisticsService.notifyProviders(event.getJDA());
}
 
Example #8
Source File: GuildListener.java    From Arraybot with Apache License 2.0 4 votes vote down vote up
/**
 * When the bot is removed from a guild.
 * @param event The event.
 */
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    new Remover(event.getGuild().getIdLong(), false).create();
    update(event.getJDA());
}
 
Example #9
Source File: BotApplicationManager.java    From lavaplayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
  // do stuff
}