Search in sources :

Example 1 with DiscordBotListAPI

use of org.discordbots.api.client.DiscordBotListAPI in project HangmanDiscordBot by megoRU.

the class BotStartConfig method topGG.

@Scheduled(fixedDelay = 20000L)
private void topGG() {
    if (!Config.isIsDev()) {
        try {
            DiscordBotListAPI TOP_GG_API = new DiscordBotListAPI.Builder().token(Config.getTopGgApiToken()).botId(Config.getBotId()).build();
            serverCount = BotStartConfig.jda.getGuilds().size();
            TOP_GG_API.setStats(serverCount);
            BotStartConfig.jda.getPresence().setActivity(Activity.playing(BotStartConfig.activity + serverCount + " guilds"));
            IOUtils.toString(new URL("http://195.2.81.139:3001/api/push/jjyiWxH1QR?msg=OK&ping="), StandardCharsets.UTF_8);
        } catch (Exception e) {
            Thread.currentThread().interrupt();
            e.printStackTrace();
        }
    }
}
Also used : URL(java.net.URL) DiscordBotListAPI(org.discordbots.api.client.DiscordBotListAPI) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Example 2 with DiscordBotListAPI

use of org.discordbots.api.client.DiscordBotListAPI in project aiode by robinfriedli.

the class TopGGComponent method getDiscordBotListAPI.

@Bean
public DiscordBotListAPI getDiscordBotListAPI() {
    DiscordBotListAPI discordBotListAPI;
    if (!Strings.isNullOrEmpty(discordBotId) && !Strings.isNullOrEmpty(topGGToken)) {
        discordBotListAPI = new DiscordBotListAPI.Builder().botId(discordBotId).token(topGGToken).build();
    } else {
        logger.info("top.gg api not set up, missing properties");
        discordBotListAPI = null;
    }
    return discordBotListAPI;
}
Also used : DiscordBotListAPI(org.discordbots.api.client.DiscordBotListAPI) Bean(org.springframework.context.annotation.Bean)

Aggregations

DiscordBotListAPI (org.discordbots.api.client.DiscordBotListAPI)2 URL (java.net.URL)1 Bean (org.springframework.context.annotation.Bean)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1