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


Java Game.listening方法代碼示例

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


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

示例1: getGameFromType

import net.dv8tion.jda.core.entities.Game; //導入方法依賴的package包/類
private Game getGameFromType(String status, AvaireShard shard) {
    Game game = Game.playing(status);
    if (status.contains(":")) {
        String[] split = status.split(":");
        status = String.join(":", Arrays.copyOfRange(split, 1, split.length));
        switch (split[0].toLowerCase()) {
            case "listen":
            case "listening":
                return Game.listening(formatGame(status, shard));

            case "watch":
            case "watching":
                return Game.watching(formatGame(status, shard));

            case "play":
            case "playing":
                return Game.playing(formatGame(status, shard));

            case "stream":
            case "streaming":
                return Game.streaming(formatGame(status, shard), "https://www.twitch.tv/senither");
        }
    }
    return game;
}
 
開發者ID:avaire,項目名稱:avaire,代碼行數:26,代碼來源:ChangeGameJob.java

示例2: parseGame

import net.dv8tion.jda.core.entities.Game; //導入方法依賴的package包/類
private Game parseGame(String[] args) {
    if (Game.isValidStreamingUrl(args[0])) {
        String url = args[0];
        String streamStatus = String.join(" ", args).substring(url.length());

        if (args.length == 1) {
            streamStatus = "Streaming on Twitch.tv";
        }

        return Game.streaming(streamStatus, url);
    }

    String status = String.join(" ", args);

    if (status.contains(":")) {
        String[] split = status.split(":");
        status = String.join(":", Arrays.copyOfRange(split, 1, split.length));
        switch (split[0].toLowerCase()) {
            case "listen":
            case "listening":
                return Game.listening(status);

            case "watch":
            case "watching":
                return Game.watching(status);

            case "play":
            case "playing":
                return Game.playing(status);

            case "stream":
            case "streaming":
                return Game.streaming(status, "https://www.twitch.tv/senither");
        }
    }

    return Game.playing(status);
}
 
開發者ID:avaire,項目名稱:avaire,代碼行數:39,代碼來源:SetStatusCommand.java

示例3: getGame

import net.dv8tion.jda.core.entities.Game; //導入方法依賴的package包/類
public Game getGame()
{
    if(game==null || game.isEmpty())
        return null;
    if(game.toLowerCase().startsWith("playing"))
        return Game.playing(game.substring(7).trim());
    if(game.toLowerCase().startsWith("listening to"))
        return Game.listening(game.substring(12).trim());
    if(game.toLowerCase().startsWith("listening"))
        return Game.listening(game.substring(9).trim());
    if(game.toLowerCase().startsWith("watching"))
        return Game.watching(game.substring(8).trim());
    return Game.playing(game);
}
 
開發者ID:jagrosh,項目名稱:MusicBot,代碼行數:15,代碼來源:Config.java


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