private async Task UpDateHighBidder(SocketUserMessage messageDetails, int bid) { var exactMessage = await messageDetails.Channel.GetMessageAsync(currentAuction) as IUserMessage; var embed2 = new EmbedBuilder(); var oldField = exactMessage.Embeds.FirstOrDefault().Fields.FirstOrDefault(); embed2.AddField(x => { x.Name = oldField.Name; x.Value = oldField.Value; x.IsInline = oldField.Inline; }); embed2.AddField(x => { x.Name = "New Highest Bid!"; x.IsInline = false; x.Value = $"{currentItem} highest bid is {bid} by {highBidder}."; }); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task Help() { var embed = new EmbedBuilder() { Color = Colors.helpCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var generalField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help general", Value = "Displays General Commands." }; var musicField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help music", Value = "Displays Music Commands." }; var bankField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help bank", Value = "Displays Bank Commands." }; var aucField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help auction", Value = "Displays Auction Commands." }; var nsfwField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help nsfw", Value = "Displays NSFW Commands." }; var adminField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help admin", Value = "Displays Admin Commands." }; embed.Title = $"╋━━━━━━◥◣ KnightBot Help ◢◤━━━━━━╋"; embed.Description = "More Commands Will Be Added Soon!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(generalField); embed.AddField(musicField); embed.AddField(bankField); embed.AddField(aucField); embed.AddField(nsfwField); embed.AddField(adminField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Points() { var points = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; if (points >= 0) { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Title = $"{Context.User.Username}'s Points"; embed.Description = $"You have " + points + " points from your fights!"; await ReplyAsync("", false, embed.Build()); } else { await errors.sendError(Context.Channel, "You appear to have negative points, contact a developer.", Colors.fightCol); } var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Auctioncheck() { var DM = await Context.User.GetOrCreateDMChannelAsync(); if (auctionCheck.Equals("over") || auctionCheck.Equals("")) { var message = await DM.SendMessageAsync("Sorry there isn't an auction at this time."); await Delete.DelayDeleteMessage(Context.Message, 10); await Delete.DelayDeleteMessage(message, 10); return; } var auctionStatus = Context.Channel.GetMessageAsync(currentAuction); var embed = auctionStatus.Result.Embeds.FirstOrDefault() as Embed; await DM.SendMessageAsync("", false, embed); await Delete.DelayDeleteMessage(Context.Message, 10); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task EightBall([Remainder] string input) { int randomIndex = rand.Next(predictionTexts.Length); string text = predictionTexts[randomIndex]; var embed = new EmbedBuilder() { Color = Colors.ballCol }; embed.Title = "**╋━━━━━━◥◣ Magic 8 Ball ◢◤━━━━━━╋**"; embed.Description = Environment.NewLine + Context.User.Mention + ", " + text; await Context.Channel.SendMessageAsync("", false, embed); await Context.Message.DeleteAsync(); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Fight(IUser user) { if (Context.User.Mention != user.Mention && SwitchCaseString == "nofight") { SwitchCaseString = "fight_p1"; player1 = Context.User.Mention; player2 = user.Mention; string[] whoStarts = new string[] { Context.User.Mention, user.Mention }; Random rand = new Random(); int randomIndex = rand.Next(whoStarts.Length); string text = whoStarts[randomIndex]; whosTurn = text; if (text == Context.User.Mention) { whoWaits = user.Mention; } else { whoWaits = Context.User.Mention; } var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = ("Fight started between " + Context.User.Mention + " and " + user.Mention + "!\n\n" + player1 + " you have " + health1 + " health!\n" + player2 + " you have " + health2 + " health!\n\n" + text + " your turn!"); await ReplyAsync("", false, embed.Build()); } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + " Sorry but there is already a fight going on, or you simply tried to fight yourself."); await ReplyAsync("", false, embed.Build()); } await Context.Message.DeleteAsync(); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task NsfwHelp() { var embed = new EmbedBuilder() { Color = Colors.nsfwCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var joinField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw join", Value = "Adds The NSFW Role To You." }; var leaveField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw leave", Value = "Removes The NSFW Role From You." }; var buttField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw butt", Value = "Perfect For Any Butt Lovers." }; var boobsField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw boobs", Value = "Perfect For Any Boobs Lovers." }; var gifField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw gif", Value = "Sends A Random Gif ;)" }; embed.Title = $"╋━━━━━━◥◣ KnightBot NSFW Help ◢◤━━━━━━╋"; embed.Description = "Here Are All Of The NSFW Commands!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(joinField); embed.AddField(leaveField); embed.AddField(buttField); embed.AddField(boobsField); embed.AddField(gifField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task addMoney(SocketMessage msg) { var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Auction(int startingBid, int amount, string item, [Remainder] string info = null) { if (auctionCheck.Equals("live")) { await ReplyAsync("A auction is currently live!"); } else { if (auctionCheck.Equals("") || auctionCheck.Equals("over")) { auctionCheck.Equals("Live"); } else if (auctionCheck == "live") { var messageToDel = await ReplyAsync("Auction already started, only auction can be held at a time!"); await Delete.DelayDeleteMessage(Context.Message, 10); await Delete.DelayDeleteMessage(messageToDel, 10); return; } var embed = new EmbedBuilder(); embed.AddField(x => { x.Name = $"Auction for {item} started {DateTime.UtcNow} UTC "; x.Value = $"{amount} x {item} is up for auction with a starting bid of {startingBid}\nType !bid [amount] to bid."; }); var message = await ReplyAsync("", embed : embed); hightBid = startingBid - 1; currentItem = item; currentAuction = message.Id; } var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task AucHelp() { var embed = new EmbedBuilder() { Color = Colors.moneyCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var auctionField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auction <amount> <quantity> <item>", Value = "Starts A New Auction." }; var auctionEndField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auctionend", Value = "Ends The Current Auction." }; var auctionCheckField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auctioncheck", Value = "Checks If There Is A Current Auction." }; var bidField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bid <amount>", Value = "Bid On The Current Auction." }; embed.Title = $"╋━━━━━━◥◣ KnightBot Auction Help ◢◤━━━━━━╋"; embed.Description = "Here Are All Of The Bank Commands!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(auctionField); embed.AddField(auctionEndField); embed.AddField(auctionCheckField); embed.AddField(bidField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Auctionover() { if (auctionCheck.Equals("over")) { await ReplyAsync("There is no auction right now."); } else { if (highBidder == null) { await Context.Channel.SendMessageAsync("The auction has ended with 0 bids."); auctionCheck = "over"; hightBid = 0; currentItem = null; currentAuction = 0; return; } var embed = new EmbedBuilder(); embed.Title = $"{highBidder} won the auction for {currentItem}"; embed.AddField(x => { x.Name = $"Auction ended at {DateTime.UtcNow} UTC"; x.Value = $"Once you pay {hightBid}, we will arrage payment and delivery of {currentItem} soon after. \n Congrats! :tada: "; x.IsInline = false; }); auctionCheck = "over"; highBidder = null; hightBid = 0; currentItem = null; currentAuction = 0; await Context.Channel.SendMessageAsync("", false, embed); } var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task BankHelp() { var embed = new EmbedBuilder() { Color = Colors.moneyCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var bankField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank open", Value = "Opens A Bank Account In Your Name!" }; var moneyField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank balance", Value = "Displays Your Current Balance!" }; var transferField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank transfer <user> <amount>", Value = "Transfer Money To Another Player." }; embed.Title = $"╋━━━━━━◥◣ KnightBot Bank Help ◢◤━━━━━━╋"; embed.Description = "Here Are All Of The Bank Commands!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(bankField); embed.AddField(moneyField); embed.AddField(transferField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task GenHelp() { var embed = new EmbedBuilder() { Color = Colors.helpCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var helpField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help", Value = "Displays The Commands The KnightBot Can Do." }; var dogField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "doggo", Value = "Displays A Random Dog Image!" }; var catField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "cat", Value = "Displays A Random Cat Image!" }; embed.Title = $"╋━━━━━━◥◣ KnightBot General Help ◢◤━━━━━━╋"; embed.Description = "More Commands Will Be Added Soon!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(helpField); embed.AddField(dogField); embed.AddField(catField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task AdminHelp() { var embed = new EmbedBuilder() { Color = Colors.adminCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var kickField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "kick <user> <reason>", Value = "Kicks The Specified User." }; var banField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "ban <user> <reason>", Value = "Bans The Specified User." }; var clearField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "clear <Amount>", Value = "Clears 1-100 Messages." }; embed.Title = $"╋━━━━━━◥◣ KnightBot Admin Help ◢◤━━━━━━╋"; embed.Description = "Here Are All Of The Bank Commands!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(kickField); embed.AddField(banField); embed.AddField(clearField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
private async Task MusicHelp() { var embed = new EmbedBuilder() { Color = Colors.musicCol }; var footer = new EmbedFooterBuilder() { Text = "Requested by " + Context.User.Username }; var playField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "play <link directly to song on youtube>", Value = "Plays The Song In Your Voice Channel!" }; var stopField = new EmbedFieldBuilder() { Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "stop", Value = "Stops The Songs That Is Currently Playing!" }; embed.Title = $"╋━━━━━━◥◣ KnightBot Music Help ◢◤━━━━━━╋"; embed.Description = "Here Are All Of The Music Commands!"; embed.WithFooter(footer); embed.WithCurrentTimestamp(); embed.AddField(playField); embed.AddField(stopField); await Context.Channel.SendMessageAsync("", false, embed); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Cat() { await Program.Logger(new LogMessage(LogSeverity.Debug, "[API]", "The Cat API Is Loading!")); using (var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate })) { string websiteurl = "http://aws.random.cat//meow"; client.BaseAddress = new Uri(websiteurl); HttpResponseMessage response = client.GetAsync("").Result; response.EnsureSuccessStatusCode(); string result = await response.Content.ReadAsStringAsync(); var json = JObject.Parse(result); string CatImage = json["file"].ToString(); var embed = new EmbedBuilder() { Color = Colors.generalCol }; embed.WithImageUrl(CatImage); await Context.Channel.SendMessageAsync("", false, embed); } await Context.Message.DeleteAsync(); var result2 = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result2 + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task GiveUp() { if (SwitchCaseString == "fight_p1") { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = ("The Fight Has Stopped!"); await ReplyAsync("", false, embed.Build()); SwitchCaseString = "nofight"; health1 = maxHealth; health2 = maxHealth; } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + ", There is no fight to stop."); await ReplyAsync("", false, embed.Build()); } await Context.Message.DeleteAsync(); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Bid(string amount) { int bid; if (auctionCheck.Equals("live")) { var message = await ReplyAsync("There's no auction at this time, ask someone to start one."); await Delete.DelayDeleteMessage(Context.Message, 10); await Delete.DelayDeleteMessage(message, 10); return; } else { try { bid = Math.Abs(int.Parse(amount)); } catch { var message = await ReplyAsync("That is not a valid bid, I am not stupid!"); await Delete.DelayDeleteMessage(Context.Message, 10); await Delete.DelayDeleteMessage(message, 10); return; } if (bid <= hightBid) { var message = await ReplyAsync("Your bid is too low, increase it and try again."); await Delete.DelayDeleteMessage(Context.Message, 10); await Delete.DelayDeleteMessage(message, 10); return; } hightBid = bid; highBidder = Context.User as SocketGuildUser; await UpDateHighBidder(Context.Message as SocketUserMessage, bid); var message2 = await ReplyAsync($"The current highest bidder is {highBidder.Mention} with a bid of {hightBid} :moneybag: "); } var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task betcmd(int bet) { var econ = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; if (econ < bet) { var embed = new EmbedBuilder() { Color = Colors.moneyCol }; embed.Description = (Context.User.Mention + ", you do not have enough money to roll the dice!"); await ReplyAsync("", false, embed.Build()); } else { Random rand = new Random(); Random rand2 = new Random(); int userRoll = rand2.Next(1, 6); int rolled = rand.Next(1, 9); Console.WriteLine("User Rolled : " + userRoll); Console.WriteLine("Bot Rolled : " + rolled); if (userRoll.Equals(rolled)) { var embed = new EmbedBuilder() { Color = Colors.moneyCol, }; embed.Title = $"Congrats {Context.User.Username}!"; embed.Description = $"You Have Made ${bet}!\n\n {Context.User.Mention} You Rolled **{userRoll}** and I rolled **{rolled}**"; await ReplyAsync("", false, embed.Build()); save.currentMoney = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney + bet; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.Save("bank/" + Context.User.Id.ToString() + ".json"); } else { int betremove = -bet; var embed = new EmbedBuilder() { Color = Colors.moneyCol, }; embed.Title = $"Sorry **{Context.User.Username}**!"; embed.Description = $"You Have Lost ${bet}!\n\n {Context.User.Mention} You Rolled **{userRoll}** and I rolled **{rolled}**"; await ReplyAsync("", false, embed.Build()); save.currentMoney = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney - bet; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.Save("bank/" + Context.User.Id.ToString() + ".json"); } } var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }
public async Task Slash() { if (SwitchCaseString == "fight_p1") { if (whosTurn == Context.User.Mention) { Random rand = new Random(); int randomIndex = rand.Next(1, 6); if (randomIndex != 1) { Random rand2 = new Random(); int randomIndex2 = rand2.Next(minDamage, maxDamage); if (Context.User.Mention != player1) { health1 = health1 - randomIndex2; if (health1 > 0) { placeHolder = whosTurn; whosTurn = whoWaits; whoWaits = placeHolder; var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + " you hit and did " + randomIndex2 + " damage!\n\n" + player1 + " has " + health1 + " health left!\n" + player2 + " has " + health2 + " health left!\n" + whosTurn + " its your turn!"); await ReplyAsync("", false, embed.Build()); } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + " you hit and did " + randomIndex2 + " damage!\n\n" + player1 + " died. " + player2 + " won!"); //Database.updPoints(Context.User, 3); save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints + 3; save.currentMoney = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.Save("bank/" + Context.User.Id.ToString() + ".json"); await ReplyAsync("", false, embed.Build()); SwitchCaseString = "nofight;"; health1 = maxHealth; health2 = maxHealth; } } else if (Context.User.Mention == player1) { health2 = health2 - randomIndex2; if (health2 > 0) { placeHolder = whosTurn; whosTurn = whoWaits; whoWaits = placeHolder; var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + " you hit and did " + randomIndex2 + " damage!\n\n" + player1 + " has " + health1 + " health left!\n" + player2 + " has " + health2 + " health left!\n" + whosTurn + " its your turn!"); await ReplyAsync("", false, embed.Build()); } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + " you hit and did " + randomIndex2 + " damage!\n\n" + player2 + " died. " + player1 + " won!"); //Database.updPoints(Context.User, 3); save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints + 3; save.currentMoney = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.Save("bank/" + Context.User.Id.ToString() + ".json"); await ReplyAsync("", false, embed.Build()); SwitchCaseString = "nofight"; health1 = maxHealth; health2 = maxHealth; } } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = ("Sorry it seems like something went wrong! Please type " + BotConfig.Load().Prefix + "giveup"); await ReplyAsync("", false, embed.Build()); } } else { placeHolder = whosTurn; whosTurn = whoWaits; whoWaits = placeHolder; var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + ", sorry you missed!\n" + whosTurn + " your turn!"); await ReplyAsync("", false, embed.Build()); } } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + ", It Is Not Your Turn!"); await ReplyAsync("", false, embed.Build()); } } else { var embed = new EmbedBuilder() { Color = Colors.fightCol }; embed.Description = (Context.User.Mention + ", There is no fight at the moment. Sorry :/"); await ReplyAsync("", false, embed.Build()); } await Context.Message.DeleteAsync(); var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney; int bal = 10; total = result + bal; save.userID = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID; save.currentMoney = total; save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints; save.Save("bank/" + Context.User.Id.ToString() + ".json"); }