protected static EmbedBuilder CreateEmbed(EmbedColor color) => new EmbedBuilder { Color = new Color((uint)color) };
public void SetColor(EmbedColor type = EmbedColor.BLUE) { Color color; switch (type) { case EmbedColor.VIOLET: color = VioletColor; break; case EmbedColor.GOLD: color = GoldColor; break; case EmbedColor.PINK: color = PinkColor; break; case EmbedColor.RED: color = RedColor; break; case EmbedColor.BLUE: color = BlueColor; break; case EmbedColor.GREEN: color = GreenColor; break; case EmbedColor.YELLOW: color = YellowColor; break; case EmbedColor.BLACK: color = BlackColor; break; case EmbedColor.LIGHT_PURPLE: color = LightPurpleColor; break; case EmbedColor.LIGHT_BLUE: color = LightBlueColor; break; case EmbedColor.ORANGE: color = OrangeColor; break; case EmbedColor.GRAY: color = GrayColor; break; case EmbedColor.MAGENTA: color = MagentaColor; break; default: color = RedColor; break; } WithColor(color); }
public EmbedBuilder CreateEmbed(EmbedColor color) { return(new EmbedBuilder { Color = new Color((uint)color) }); }
public KaguyaEmbedBuilder(EmbedColor type) { SetColor(type); }
public async Task Command(int points, string input) { User user = await DatabaseQueries.GetOrCreateUserAsync(Context.User.Id); Server server = await DatabaseQueries.GetOrCreateServerAsync(Context.Guild.Id); if (points < 100) { await SendBasicErrorEmbedAsync($"{Context.User.Mention} The minimum bet for this game is `100` points."); return; } if (points > 50000 && !user.IsPremium && !server.IsPremium) { await SendBasicErrorEmbedAsync($"{Context.User.Mention} Sorry, you must be either an active " + $"[Kaguya Premium]({ConfigProperties.KAGUYA_STORE_URL}) subscriber " + $"or be present in a server in which Kaguya Premium is active to bet " + $"more than `50,000` points."); return; } if (points > 500000 && (user.IsPremium || server.IsPremium)) { await SendBasicErrorEmbedAsync($"{Context.User.Mention} Sorry, the maximum points you may bet regardless " + $"of [Kaguya Premium]({ConfigProperties.KAGUYA_STORE_URL}) " + $"status is `500,000` points."); return; } if (user.Points < points) { await SendBasicErrorEmbedAsync($"{Context.User.Mention} You do not have enough points to perform this action.\n\n" + $"Attempted to bet: `{points:N0}` points.\n" + $"Available balance: `{user.Points:N0}`"); return; } var r = new Random(); int rollOne = r.Next(2, 7); //upper-bound integer is exclusive while lower-bound is inclusive. int rollTwo = r.Next(2, 7); int combinedScore = rollOne + rollTwo; DicePrediction prediction = GetDicePrediction(input); DiceOutcome outcome = GetDiceOutcome(combinedScore); bool winner = (int)prediction == (int)outcome; int payout = GetWinningPayout(points, outcome); EmbedColor eColor = winner ? EmbedColor.GOLD : EmbedColor.GRAY; if (winner) { user.Points += payout; } else { payout = -points; user.Points += payout; // We are adding a negative number. } var gambleH = new GambleHistory { UserId = user.UserId, Action = GambleAction.DICE_ROLL, Bet = points, Payout = payout, Roll = combinedScore, Time = DateTime.Now.ToOADate(), Winner = winner, User = user }; await DatabaseQueries.InsertAsync(gambleH); string formattedPayout = winner ? $"+{payout:N0}" : $"-{points:N0}"; var embed = new KaguyaEmbedBuilder(eColor) { Title = "Dice Roll", Description = DiceDescription(rollOne, rollTwo, points, winner, outcome, prediction), Footer = new EmbedFooterBuilder { Text = $"New Points Balance: {user.Points:N0} ({formattedPayout})" } }; await SendEmbedAsync(embed); await DatabaseQueries.UpdateAsync(user); }