本文整理匯總了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;
}
示例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);
}
示例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);
}