public static void getTickets(int GiveAwayID, ICommandContext context) { GiveAway giveAway = GiveAways[GiveAwayID - 1]; int amount = 0; amount = giveAway.tickets.FirstOrDefault(x => x.userDataSet.userID == context.User.Id).ticketAmount; context.Channel.SendMessageAsync($"You own {amount} Tickets of the pool of {giveAway.GetTotalTickets()} Tickets."); }
static EmbedBuilder CreateMessageEmbed(GiveAway newGiveAway) { string statusString = ""; Color statusColor = new Color(); switch (newGiveAway.state) { case GiveAwayState.Cancelled: statusString = "Cancelled"; statusColor = Color.Red; break; case GiveAwayState.Ended: statusString = "Ended"; statusColor = Color.LightGrey; break; case GiveAwayState.Open: statusString = "Open"; statusColor = Color.Green; break; case GiveAwayState.Pending: statusString = "Pending"; statusColor = Color.LightOrange; break; } EmbedBuilder embed = new EmbedBuilder() { Color = statusColor, Title = $"GiveAway #{newGiveAway.id}" }; embed.AddField(new EmbedFieldBuilder() { Name = "Ticket Cost:", Value = newGiveAway.ticketEntryCost + " Ξ" }); embed.AddField(new EmbedFieldBuilder() { Name = "\u200B", Value = "\u200B" }); embed.AddField(new EmbedFieldBuilder() { Name = "__**Rewards:**__", Value = "\u200B" }); int rewardIndex = 1; foreach (GiveAwayReward reward in newGiveAway.rewards) { string valueString = reward.rewardString; if (reward.winner != null) { valueString += $" - **Winner: {Program.guild.GetUser(reward.winner.userID).Mention}**"; } embed.AddField(new EmbedFieldBuilder() { Name = $"Reward {rewardIndex}:", Value = valueString }); rewardIndex++; } embed.AddField(new EmbedFieldBuilder() { Name = "\u200B", Value = "\u200B" }); embed.AddField(new EmbedFieldBuilder() { Name = "Status:", Value = statusString }); embed.AddField(new EmbedFieldBuilder() { Name = "Total Entries:", Value = newGiveAway.GetTotalTickets() }); embed.AddField(new EmbedFieldBuilder() { Name = "End Date:", Value = newGiveAway.endDateTime.Date.ToString("dd/MM/yy") }); embed.Footer = new EmbedFooterBuilder() { Text = "Giveaway created: " + newGiveAway.openDateTime.Date.ToString("dd/MM/yy") }; return(embed); }