diff --git a/src/main/java/com/mazawrath/beanbot/commands/beanmarket/BeanInvestCommand.java b/src/main/java/com/mazawrath/beanbot/commands/beanmarket/BeanInvestCommand.java index 4ba84b2..60e1a0a 100644 --- a/src/main/java/com/mazawrath/beanbot/commands/beanmarket/BeanInvestCommand.java +++ b/src/main/java/com/mazawrath/beanbot/commands/beanmarket/BeanInvestCommand.java @@ -24,7 +24,7 @@ public BeanInvestCommand(Points points, StockMarket stockMarket) { @Command( aliases = {"beanInvest", "coinInvest"}, description = "Lets you invest in companies from the Bean Market.", - usage = "beanInvest [[buy/sell] [symbol]]", + usage = "beanInvest [[buy/sell/check] [symbol]]", privateMessages = false ) @@ -33,7 +33,8 @@ public void onCommand(String[] args, ServerTextChannel serverTextChannel, User a serverTextChannel.sendMessage("No arguments for this command are currently not supported. In the future this will be a way to look at your portfolio and all the shares you have invested in.\n" + "Instructions for `.beaninvest`.\n" + "\t- `.beaninvest buy [symbol] [amount]` - Buys shares from that symbol.\n" + - "\t- `.beaninvest sell [symbol]` - Sells all shares bought from that symbol."); + "\t- `.beaninvest sell [symbol]` - Sells all shares bought from that symbol." + + "\t- `.beaninvest check [symbol]` - Checks how many shares are bought from that symbol."); } else if (args[0].equals("buy")) { EmbedBuilder embed = new EmbedBuilder() .setTitle("Bean Market Investment") diff --git a/src/main/java/com/mazawrath/beanbot/commands/maza/MazaPostChangeLogCommand.java b/src/main/java/com/mazawrath/beanbot/commands/maza/MazaPostChangeLogCommand.java index a8aa491..afddc3a 100644 --- a/src/main/java/com/mazawrath/beanbot/commands/maza/MazaPostChangeLogCommand.java +++ b/src/main/java/com/mazawrath/beanbot/commands/maza/MazaPostChangeLogCommand.java @@ -28,15 +28,16 @@ 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/compare/v2.6.0...v2.6.1\n" + + "Release can be found on https://github.com/Mazawrath/beanBOT/releases/tag/v2.6.2\n" + + "Detailed changelog can be found on https://github.com/Mazawrath/beanBOT/compare/v2.6.1...v2.6.2\n" + "\n" + - "**v2.6.1**\n" + + "**v2.6.2**\n" + "**New**\n" + "\t- Bean Market\n" + - "\t\t- Added `BEAB` (Blissful Beans).\n" + - //"**Changes**\n" + - //"\t- Changed chances of winning `.beanbet` from 35% to 45%.\n" + + "\t\t- Added `WEEB` (MicroWeeb).\n" + + "**Changes**\n" + + "\t- Added extra info when using `.beaninvest` without any arguments.\n" + "**Bug Fixes**\n" + - "\t- Fixed an issue with selling shares."; + "\t- Fixed an issue with selling or checking stocks you never bought."; } } diff --git a/src/main/java/com/mazawrath/beanbot/utilities/StockMarket.java b/src/main/java/com/mazawrath/beanbot/utilities/StockMarket.java index afab08f..d5d0f0c 100644 --- a/src/main/java/com/mazawrath/beanbot/utilities/StockMarket.java +++ b/src/main/java/com/mazawrath/beanbot/utilities/StockMarket.java @@ -18,7 +18,7 @@ public class StockMarket { private static final RethinkDB r = new RethinkDB(); - public static final String[] COMPANIES = {"BEAN", "FBI", "SHTEB", "BEZFF", "ABD", "BNTC", "BETHS", "BEAB"}; + public static final String[] COMPANIES = {"BEAN", "FBI", "SHTEB", "BEZFF", "ABD", "BNTC", "BETHS", "BEAB", "WEEB"}; private static final String DB_VALUE_PREFIX = "P_"; Connection conn; @@ -145,6 +145,12 @@ public static JSONObject getCompanyInfo(String symbol) { companyInfo.put("Symbol", symbol); symbol = getSymbol(symbol); break; + case "WEEB": + companyInfo.put("Name", "MicroWeeb"); + companyInfo.put("Logo", "https://cdn.discordapp.com/attachments/480959729330290688/519694521144049674/Untitled.png"); + companyInfo.put("Symbol", symbol); + symbol = getSymbol(symbol); + break; default: return null; } @@ -183,6 +189,8 @@ public String getCompanyName(String beanSymbol) { return "Papa BEETHS"; case "BEAB": return "Blissful Beans"; + case "WEEB": + return "MicroWeeb"; default: return null; } @@ -206,6 +214,8 @@ public static String getSymbol(String beanSymbol) { return "PZZA"; case "BEAB": return "SBUX"; + case "WEEB": + return "MSFT"; default: return null; } @@ -225,10 +235,14 @@ public BigDecimal getStockPrice(String symbol, boolean beanSymbol) { } public BigDecimal getShareInvested(String userID, String serverID, String symbol) { + checkUser(userID, serverID); + checkCompany(userID, serverID, symbol); return new BigDecimal(parseValueFromDB(r.db("beanBotStock").table(serverID).get(userID).getField(symbol + " shares bought").run(conn))).setScale(Points.SCALE, Points.ROUNDING_MODE); } public BigDecimal getBeanCoinSpent(String userID, String serverID, String symbol) { + checkUser(userID, serverID); + checkCompany(userID, serverID, symbol); return new BigDecimal(parseValueFromDB(r.db("beanBotStock").table(serverID).get(userID).getField(symbol + " beanCoin spent").run(conn))).setScale(Points.SCALE, Points.ROUNDING_MODE); }