Skip to content

Commit

Permalink
Merge pull request #17 from Mazawrath/development
Browse files Browse the repository at this point in the history
v2.3.0
  • Loading branch information
Mazawrath authored Sep 25, 2018
2 parents 5211510 + 18d3de0 commit aa06141
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/mazawrath/beanbot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static void main(String[] args) {
cmdHandler.registerCommand(new ShameCommand(points));
cmdHandler.registerCommand(new AsgCommand(points));
cmdHandler.registerCommand(new GrindCommand(points));
cmdHandler.registerCommand(new GnomedCommand(points));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class SourceCommand implements CommandExecutor {
@Command(
aliases = {"source"},
description = "Gives a link to beanBOT's source code",
usage = "top500",
usage = "source",
privateMessages = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public void onCommand(ServerTextChannel serverTextChannel, User author, Server s
long timeLeft = points.giveFreePoints(author.getIdAsString(), server.getIdAsString());

if (timeLeft == 0) {
serverTextChannel.sendMessage("You have received 25 beanCoin.");
serverTextChannel.sendMessage("You have received 25 beanCoin." + " You now have " + points.getBalance(author.getIdAsString(), server.getIdAsString()) + " beanCoin.");
} else {
StringBuilder message = new StringBuilder();

message.append("You have already received free beanCoin today. You can receive beanCoin in ");

String dateStart = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
.format(new java.util.Date (System.currentTimeMillis()));
String dateStop = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
Expand All @@ -51,7 +55,16 @@ public void onCommand(ServerTextChannel serverTextChannel, User author, Server s
long diffMinutes = diff / (60 * 1000) % 60;
long diffHours = diff / (60 * 60 * 1000) % 24;

serverTextChannel.sendMessage("You have already received free beanCoin today. You can receive beanCoin in " + diffHours + " hours " + diffMinutes + " minutes.");
if (diffHours == 1)
message.append(diffHours).append(" hour ");
else
message.append(diffHours).append(" hours ");
if (diffMinutes == 1)
message.append(diffMinutes).append(" minute.");
else
message.append(diffMinutes).append(" minutes.");

serverTextChannel.sendMessage(message.toString());

} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public void onCommand(String[] args, ServerTextChannel serverTextChannel) {
.setDescription(obj.getString("Symbol"))
.setThumbnail(obj.getString("Logo"))
.addInlineField("Price", obj.getBigDecimal("Price").setScale(2, RoundingMode.HALF_UP).toString())
.addInlineField("Percentage Change", obj.getString("Percentage Change"))
.addInlineField("Opened at", obj.getBigDecimal("Opened").setScale(2, RoundingMode.HALF_UP).toString())
.addInlineField("Daily Percentage Change", obj.getBigDecimal("Percentage Change") + "%")
.addInlineField("Previously Closed At", obj.getBigDecimal("Previous Close").setScale(2, RoundingMode.HALF_UP).toString())
.addInlineField("50 Day Percentage Change", obj.getBigDecimal("50 Day Percentage Change").setScale(2, RoundingMode.HALF_UP).toString() + "%")
.addInlineField("Yearly High", obj.getBigDecimal("Year High").setScale(2, RoundingMode.HALF_UP).toString())
.addInlineField("Yearly Low", obj.getBigDecimal("Year Low").setScale(2, RoundingMode.HALF_UP).toString());
serverTextChannel.sendMessage(embed);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.mazawrath.beanbot.commands.copypasta;

import com.mazawrath.beanbot.utilities.Points;
import de.btobastian.sdcf4j.Command;
import de.btobastian.sdcf4j.CommandExecutor;
import org.javacord.api.DiscordApi;
import org.javacord.api.entity.channel.ServerTextChannel;
import org.javacord.api.entity.message.embed.EmbedBuilder;
import org.javacord.api.entity.server.Server;
import org.javacord.api.entity.user.User;

public class GnomedCommand implements CommandExecutor {
private Points points;

public GnomedCommand(Points points) {
this.points = points;
}

@Command(
aliases = {"gnomed", "banuser", "everyone"},
usage = "banuser [discriminated name]",
description = "Bans a user",
privateMessages = false
)

public void onCommand(DiscordApi api, ServerTextChannel serverTextChannel, User author, Server server) {
if (points.removePoints(author.getIdAsString(), api.getYourself().getIdAsString(), server.getIdAsString(), 2)) {
serverTextChannel.sendMessage("``` __\n" +
" .-' |\n" +
" / <\\| 'Ello me ol' chum\n" +
" / \\'\n" +
" |_.- o-o I'm g'not a g'nelf\n" +
" / C -._)\\\n" +
" /', | I'm g'not a g'noblin\n" +
" | `-,_,__,'\n" +
" (,,)====[_]=| I'm a g'nome and you've been GNOMED\n" +
" '. ____/\n" +
" | -|-|_\n" +
" |____)_)```");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ public void onCommand(String command, String id, DiscordApi api, ServerTextChann

private String getRecentChangeLog() {
return "**New beanBOT update released.**\n" +
"Detailed changelog can be found on https://github.com/Mazawrath/beanBOT/releases/tag/v2.2.0\n" +
"**v2.2.0**\n" +
"Detailed changelog can be found on https://github.com/Mazawrath/beanBOT/releases/tag/v2.3.0\n" +
"**v2.3.0**\n" +
"**New**\n" +
"\t- Added start of the Bean Market.\n" +
"\t- Added `.beanmarket`.\n" +
"\t\t- Can only look at companies. Currently cannot invest any beanCoin.\n" +
"\t- Added `.asg`.\n" +
"\t- Added `.grind`.\n" +
"\t- Added `.mazaposthelp`.\n" +
"\t- Added `.banuser`.\n" +
"\t- Added Papa BEETHS as a stock.\n" +
"**Changes**\n" +
"\t- Looking up users with `.userinfo` is now free\n" +
"\t- `.react` beanCoin cost changed from 5 beanCoin to 2 beanCoin\n" +
"\t- `.beanfree` now tells you how long you have until you can use `.beanfree` again.\n" +
"\t- `.beanfree` now tells you how many beanCoin you have if you received beanCoin from the command.\n" +
"\t- `.beanfree` now uses singular or plural based on whether the amount of hours or minutes.\n" +
"\t- Companies looked up with `.beanmarket` show more info.\n" +
"**Bug Fixes**\n" +
"\t- `.react` now supports up to 4 words";
"\t- Fixed `Points.java` that arbitrarily added beanCoin to a specific user ID vs the user ID of the bot itself.\n" +
"\t- Fixed `.source` not showing up on `.help`";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public static JSONObject getCompanyInfo(String symbol) {
Stock company = YahooFinance.get(symbol);

companyInfo.put("Price", company.getQuote().getPrice());
companyInfo.put("Opened", company.getQuote().getOpen());
companyInfo.put("Previous Close", company.getQuote().getPreviousClose());
companyInfo.put("Year High", company.getQuote().getYearHigh());
companyInfo.put("Year Low", company.getQuote().getYearLow());
//companyInfo.put("", company.getQuote())
companyInfo.put("Percentage Change", company.getQuote().getChangeInPercent() + "%");
companyInfo.put("50 Day Percentage Change", company.getQuote().getChangeFromAvg50InPercent());
companyInfo.put("Percentage Change", company.getQuote().getChangeInPercent());

return companyInfo;
} catch (IOException e) {
Expand Down

0 comments on commit aa06141

Please sign in to comment.