本文整理汇总了Java中org.pircbotx.Colors.TEAL属性的典型用法代码示例。如果您正苦于以下问题:Java Colors.TEAL属性的具体用法?Java Colors.TEAL怎么用?Java Colors.TEAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.pircbotx.Colors
的用法示例。
在下文中一共展示了Colors.TEAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatCoinRequest
/**
* Handles the formatting for the bot's coin request.
*
* @param currency The list of currencies retrieved from the coinmarketcap API.
* @param nf The NumberFormat instance for formatting currencies.
* @return The bot's formatted response.
*/
private BotResponse formatCoinRequest(final List<CoinMarketCapResponse> currency, final NumberFormat nf) {
String dayChange = getColoredChangeText(currency.get(0).getPercentChange24h());
String hourChange = getColoredChangeText(currency.get(0).getPercentChange1h());
String weekChange = getColoredChangeText(currency.get(0).getPercentChange7d());
if (currency.get(0).getMarketCapUsd() != null) {
return new BotResponse(BotIntention.CHAT, null, Colors.CYAN + Colors.BOLD
+ currency.get(0).getName() + Colors.NORMAL + Colors.TEAL + ": "
+ nf.format(Double.valueOf(currency.get(0).getPriceUsd())) + " | Rank: "
+ currency.get(0).getRank() + Colors.TEAL + " | Market Cap: "
+ nf.format(Double.valueOf(currency.get(0).getMarketCapUsd())),
Colors.TEAL
+ "[Hour " + hourChange + "] | [Day " + dayChange + "] | [Week " + weekChange + "]");
} else {
return new BotResponse(BotIntention.CHAT, null, Colors.CYAN + Colors.BOLD
+ currency.get(0).getName() + Colors.NORMAL + Colors.TEAL + ": "
+ nf.format(Double.valueOf(currency.get(0).getPriceUsd()))
+ " | Rank: " + currency.get(0).getRank()
+ " | [" + dayChange + "] ",
"Market Cap: N/A");
}
}
示例2: getJohnQuote
public String getJohnQuote(int line) {
String name = "John";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例3: getAraneaQuote
public String getAraneaQuote(int line) {
String name = "Aranea";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例4: getMeulinQuote
public String getMeulinQuote(int line) {
String name = "Meulin";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例5: getKarkatQuote
public String getKarkatQuote(int line) {
String name = "Karkat";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例6: getCalibornQuote
public String getCalibornQuote(int line) {
String name = "Caliborn";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例7: getJadespriteQuote
public String getJadespriteQuote(int line) {
String name = "Jadesprite";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例8: getCalspriteQuote
public String getCalspriteQuote(int line) {
String name = "Calsprite";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例9: getMitunaQuote
public String getMitunaQuote(int line) {
String name = "Mituna";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例10: getFeferiQuote
public String getFeferiQuote(int line) {
String name = "Feferi";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例11: getErisolspriteQuote
public String getErisolspriteQuote(int line) {
String name = "Erisolsprite";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例12: getDavespriteQuote
public String getDavespriteQuote(int line) {
String name = "Davesprite";
File FILE = new File("./files/quotes/" + name.toLowerCase() + "-quotes.txt");
if(!FILE.exists()) {
try {
Downloader.downloadFile(new URL(FILE_BASE + "/quotes/" + FILE.getName()), FILE);
} catch (MalformedURLException e) {
logger.error("COULD NOT DOWNLOAD " + name.toUpperCase() + " FROM \"" + FILE_BASE + "/quotes/" + FILE.getName() + "\"", e);
}
}
int numOfLines = FileHelper.countLines(FILE);
if (line > numOfLines) {
return "Please enter a number from 1-" + numOfLines;
}
return Colors.TEAL + Colors.BOLD + "Quote #" + line + " - " + Colors.NORMAL + FileHelper.readLine(FILE, line);
}
示例13: onMessage
@Override
public void onMessage(MessageEvent event) throws Exception {
String msg = event.getMessage();
if (msg.startsWith(Helix.botPrefix + Commands.youTubeSearch) && ((msg.length() > (Commands.youTubeSearch.length()+2) && msg.charAt(Commands.youTubeSearch.length()+1) == ' ') || (msg.length() > (Commands.youTubeSearch.length()+3) && Arrays.asList(Helix.valid).contains(msg.charAt(Commands.youTubeSearch.length()+1)) && msg.charAt(Commands.youTubeSearch.length()+2) == ' '))){
String q = msg.split(" ", 2)[1];
String max = msg.charAt(3) == ' ' ? "1" : String.valueOf(msg.charAt(3));
String a = String.format("https://www.googleapis.com/youtube/v3/search?part=id&maxResults=%s®ionCode=br&type=video&q=%s&key=%s", max, URLEncoder.encode(q, "UTF-8"), Helix.properties.get("google.apikey"));
JSONObject v;
JSONObject snip;
String views;
String dislike;
String like;
String len;
String m;
try {
v = new JSONObject(Util.getHTTPResponse(String.format("https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,statistics&id=%s&key=%s", (new JSONObject(Util.getHTTPResponse(a))).getJSONArray("items").getJSONObject(Integer.valueOf(max) - 1).getJSONObject("id").getString("videoId"), Helix.properties.get("google.apikey")))).getJSONArray("items").getJSONObject(0);
snip = v.getJSONObject("snippet");
JSONObject stat = v.getJSONObject("statistics");
views = Helix.numberFormat.format(Long.parseLong(stat.getString("viewCount")));
dislike = Helix.numberFormat.format(Integer.parseInt(stat.getString("dislikeCount")));
like = Helix.numberFormat.format(Integer.parseInt(stat.getString("likeCount")));
len = v.getJSONObject("contentDetails").getString("duration");
m = Colors.BOLD + Colors.BLACK + ",00[You" + Colors.WHITE + ",04Tube]" + Colors.NORMAL + " " + snip.getString("title") + " [" + Colors.OLIVE + (len.equals("PT0S")? "Live" : Util.parseYouTubeTime(len)) + Colors.NORMAL + "] [" + Colors.TEAL + views + Colors.NORMAL + "] [" + Colors.DARK_GREEN + "+" + like + Colors.NORMAL + "] [" + Colors.RED + "-" + dislike + Colors.NORMAL + "] [" + Colors.MAGENTA + snip.getString("channelTitle") + Colors.NORMAL + "] http://youtu.be/" + v.getString("id");
} catch (JSONException e){
m = "Video not found! \"" + Colors.BOLD + q + Colors.NORMAL + "\"";
}
event.getChannel().send().message(m);
}
}
示例14: getColoredChangeText
/**
* Convenience method for getting colored change text depending on positive or negative change.
*
* @param change The change for whatever duration of time, be it positive or negative.
* @return The formatted string with colors.
*/
private String getColoredChangeText(final String change) {
if (change.startsWith("-")) {
return Colors.RED + change + "%" + Colors.NORMAL + Colors.TEAL;
}
return Colors.GREEN + "+" + change + "%" + Colors.NORMAL + Colors.TEAL;
}
示例15: handleParty
/**
* Handles the partying coin command.
*
* @param currencies The list of currencies from CoinMarketCap.
* @param nf The NumberFormat instance for formatting currencies.
* @param cmd The command issued, either "party" or "dump".
* @return the bot's response.
*/
private BotResponse handleParty(final List<CoinMarketCapResponse> currencies, final NumberFormat nf,
final String cmd) {
double result = 0;
CoinMarketCapResponse partyCoin = null;
for (CoinMarketCapResponse x : currencies) {
try {
double change = Double.parseDouble(x.getPercentChange24h());
if (cmd.equals("party") && change > result) {
partyCoin = x;
} else if (cmd.equals("dump") && change < result) {
partyCoin = x;
}
} catch (NumberFormatException ex) {
log.warn("Failed to parse change data: " + x.getPercentChange24h());
}
}
String color;
if (cmd.equals("party")) {
color = Colors.MAGENTA;
} else {
color = Colors.BROWN;
}
if (partyCoin != null) {
return new BotResponse(BotIntention.CHAT, null, color + Colors.BOLD
+ partyCoin.getName() + Colors.NORMAL + Colors.TEAL + ": "
+ nf.format(Double.valueOf(partyCoin.getPriceUsd())) + " | Rank: "
+ partyCoin.getRank() + Colors.TEAL + " | Market Cap: "
+ nf.format(Double.valueOf(partyCoin.getMarketCapUsd())),
Colors.TEAL
+ "[Hour " + getColoredChangeText(partyCoin.getPercentChange1h()) + "] | "
+ "[Day " + getColoredChangeText(partyCoin.getPercentChange24h()) + "]");
} else {
log.error("Failed to find a partying coin!");
return new BotResponse(BotIntention.NO_REPLY, null, null);
}
}