當前位置: 首頁>>代碼示例>>Java>>正文


Java JDABuilder.setStatus方法代碼示例

本文整理匯總了Java中net.dv8tion.jda.core.JDABuilder.setStatus方法的典型用法代碼示例。如果您正苦於以下問題:Java JDABuilder.setStatus方法的具體用法?Java JDABuilder.setStatus怎麽用?Java JDABuilder.setStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.dv8tion.jda.core.JDABuilder的用法示例。


在下文中一共展示了JDABuilder.setStatus方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initDiscord

import net.dv8tion.jda.core.JDABuilder; //導入方法依賴的package包/類
private static void initDiscord() {
	JDABuilder builder = new JDABuilder(AccountType.BOT);
	try {
		builder.setToken(BotConfig.DISCORD_TOKEN);
		builder.setAutoReconnect(true);
		builder.setStatus(OnlineStatus.ONLINE);
		builder.addEventListener(new ReadyListener());
		builder.addEventListener(new MessageListener());

		builder.buildBlocking();
	} catch (Throwable e) {
		e.printStackTrace();
	} finally {
		builder.setStatus(OnlineStatus.OFFLINE);
	}
}
 
開發者ID:BlackCraze,項目名稱:GameResourceBot,代碼行數:17,代碼來源:Main.java

示例2: start

import net.dv8tion.jda.core.JDABuilder; //導入方法依賴的package包/類
public void start() throws LoginException, InterruptedException, RateLimitedException {
    running = true;

    // init logger
    AnsiConsole.systemInstall();
    log = Logger.getLogger("Kyoko");
    log.setUseParentHandlers(false);
    ColoredFormatter formatter = new ColoredFormatter();
    ConsoleHandler handler = new ConsoleHandler();
    handler.setFormatter(formatter);
    log.addHandler(handler);

    log.info("Kyoko v" + Constants.VERSION + " is starting...");

    i18n.loadMessages();

    JDABuilder builder = new JDABuilder(AccountType.BOT);
    if (settings.getToken() != null) {
        if (settings.getToken().equalsIgnoreCase("Change me")) {
            System.out.println("No token specified, please set it in config.json");
            System.exit(1);
        }
        builder.setToken(settings.getToken());
    }

    boolean gameEnabled = false;
    if (settings.getGame() != null && !settings.getGame().isEmpty()) {
        gameEnabled = true;
        builder.setGame(Game.of("booting..."));
    }

    builder.setAutoReconnect(true);
    builder.setBulkDeleteSplittingEnabled(false);
    builder.addEventListener(eventHandler);
    builder.setAudioEnabled(true);
    builder.setStatus(OnlineStatus.IDLE);
    jda = builder.buildBlocking();

    log.info("Invite link: " + "https://discordapp.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId() + "&scope=bot&permissions=" + Constants.PERMISSIONS);

    if (gameEnabled) {
        Thread t = new Thread(new Kyoko.BlinkThread());
        t.start();
    }

    registerCommands();
}
 
開發者ID:gabixdev,項目名稱:Kyoko,代碼行數:48,代碼來源:Kyoko.java

示例3: main

import net.dv8tion.jda.core.JDABuilder; //導入方法依賴的package包/類
public static final void main(String[] args) {
    try {
        Standard.setStarted(Instant.now());
        System.setOut(new SystemOutputStream(System.out, false));
        System.setErr(new SystemOutputStream(System.err, true));
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            //Standard.STANDARD_SETTINGS.saveSettings(); //FIXME WTF This is deleting the settings file all the time?!
            Standard.saveAllGuildSettings();
        }));
        Standard.JDA_SUPPLIER = () -> jda;
        NetworkUtil.init();
        reload();
        MySQL.init();
        builder = new JDABuilder(AccountType.BOT);
        builder.setAutoReconnect(true);
        //builder.setAudioSendFactory(null);
        builder.setStatus(OnlineStatus.ONLINE);
        builder.setGame(game = Game.of("Supreme-Bot"));
        initListeners();
        initCommands();
        init();
        initPlugins();
        loadAllGuilds();
        startJDA();
    } catch (Exception ex) {
        System.err.println("Main Error: " + ex);
        ex.printStackTrace();
    }
}
 
開發者ID:Panzer1119,項目名稱:Supreme-Bot,代碼行數:30,代碼來源:SupremeBot.java


注:本文中的net.dv8tion.jda.core.JDABuilder.setStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。