Example #1
0
        public async Task DeclineMarriageAsync(EventContext e)
        {
            using (MikiContext context = new MikiContext())
            {
                var marriages = await Marriage.GetProposalsReceived(context, e.Author.Id.ToDbLong());

                if (marriages.Count == 0)
                {
                    throw new Exception("You do not have any proposals.");
                }

                UserMarriedTo m = await SelectMarriageAsync(e, context, marriages);

                string otherName = await User.GetNameAsync(context, m.GetOther(e.Author.Id.ToDbLong()));

                new EmbedBuilder()
                {
                    Title       = $"🔫 You shot down {otherName}!",
                    Description = $"Aww, don't worry {otherName}. There is plenty of fish in the sea!",
                    Color       = new Color(191, 105, 82)
                }.ToEmbed().QueueToChannel(e.Channel);

                m.Remove(context);
                await context.SaveChangesAsync();
            }
        }
Example #2
0
        public async Task DivorceAsync(EventContext e)
        {
            using (MikiContext context = new MikiContext())
            {
                var marriages = await Marriage.GetMarriagesAsync(context, e.Author.Id.ToDbLong());

                if (marriages.Count == 0)
                {
                    throw new Exception("You're not married to anyone.");
                }

                UserMarriedTo m = await SelectMarriageAsync(e, context, marriages);

                string otherName = await User.GetNameAsync(context, m.GetOther(e.Author.Id.ToDbLong()));

                EmbedBuilder embed = Utils.Embed;
                embed.Title       = $"🔔 {e.GetResource("miki_module_accounts_divorce_header")}";
                embed.Description = e.GetResource("miki_module_accounts_divorce_content", e.Author.Username, otherName);
                embed.Color       = new Color(0.6f, 0.4f, 0.1f);
                embed.ToEmbed().QueueToChannel(e.Channel);

                m.Remove(context);
                await context.SaveChangesAsync();
            }
        }