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

The following examples show how to use net.dv8tion.jda.api.events.guild.GuildLeaveEvent. These examples are extracted from open source projects. 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 Project: SkyBot   Source File: GuildListener.java    License: 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 Project: MantaroBot   Source File: MantaroListener.java    License: 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 Project: SkyBot   Source File: GuildListener.java    License: 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
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    playerService.stop(null, event.getGuild());
}
 
Example 5
Source Project: JuniperBot   Source File: MafiaListener.java    License: 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 Project: JuniperBot   Source File: GuildListener.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
    coolDownService.clear(event.getGuild());
}
 
Example 7
public void onGuildLeave(GuildLeaveEvent event) {
    statisticsService.notifyProviders(event.getJDA());
}
 
Example 8
Source Project: Arraybot   Source File: GuildListener.java    License: 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 Project: lavaplayer   Source File: BotApplicationManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onGuildLeave(GuildLeaveEvent event) {
  // do stuff
}