Beispiel #1
0
        public async Task Decline([Remainder] string str = "")
        {
            //common variables
            IUser        user = Context.User;
            EmbedBuilder eb   = new EmbedBuilder();

            eb.WithAuthor(user);
            eb.WithColor(ProfileDb.GetHex(out string colour, user.Id) ? (Discord.Color)UserUtil.HexToColor(colour) : BasicUtil.RandomColor());

            var proposals = MarriageDb.GetProposalsReceived(user.Id, Context.Guild.Id);

            proposals.AddRange(MarriageDb.GetProposalsSent(user.Id, Context.Guild.Id));
            var proposal = await UserUtil.SelectMarriage(proposals, this);

            if (proposal == null)
            {
                eb.WithDescription("~ You have no proposals ~");
                await Context.Channel.SendMessageAsync($"", false, eb.Build());

                return;
            }

            ulong wife = UserUtil.GetWifeId(proposal, user.Id);
            // Swagness
            //creating decline action
            var decline = new DialogueBoxOption
            {
                Action = async(IUserMessage message) => {
                    await MarriageDb.DeleteMarriageOrProposal(proposal);

                    //embed
                    eb.WithAuthor(user);
                    eb.WithDescription($"You declined the proposal.\nBetter luck next time **{ BasicUtil.IdToMention(wife) }**.");
                    await message.ModifyAsync(x => x.Embed = eb.Build());

                    //execution condition
                },
                After = OnExecute.RemoveReactions
            };

            //creating cancel
            var cancel = new DialogueBoxOption {
                After = OnExecute.Delete
            };

            //making dialog embed
            var dia = new DialogueBox();

            dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), decline);
            dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel);
            dia.Timeout = new TimeSpan(0, 1, 0);
            dia.Embed   = new EmbedBuilderPrepared(user)
                          .WithDescription($"Are you sure you wish to Decline **{ BasicUtil.IdToMention(wife) }**?").Build();

            //
            await DialogueReplyAsync(dia);
        }
Beispiel #2
0
        public async Task SellWaifu([Remainder] string str = "")
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id)), this);

            //waifus existance
            if (waifu == null)
            {
                return;
            }

            int worth = WaifuUtil.GetSalePrice(waifu.Tier);

            var sell = new DialogueBoxOption();

            sell.Action = async(IUserMessage message) =>
            {
                if (!UserInventoryDb.OwnsWaifu(Context.User.Id, waifu, Context.Guild.Id))
                {
                    await message.ModifyAsync(x => {
                        x.Embed = new EmbedBuilderPrepared(Context.User).WithDescription("You tried :star:").Build();
                    });

                    return;
                }

                try { await BalanceDb.AddToasties(Context.User.Id, worth, Context.Guild.Id); }
                catch (Exception ex) { await Context.Channel.SendMessageAsync(ex.Message); }

                //removing waifu + confirmation
                await UserInventoryDb.DeleteWaifu(Context.User.Id, waifu, Context.Guild.Id);

                await message.ModifyAsync(x => {
                    x.Content = $"You sold **{waifu.Name}** for **{worth.ToString("n0")}** toasties.";
                    x.Embed   = ToastieUtil.ToastieEmbed(Context.User, BalanceDb.GetToasties(Context.User.Id, Context.Guild.Id)).Build();
                });
            };
            sell.After = OnExecute.RemoveReactions;

            var cancel = new DialogueBoxOption();

            cancel.After = OnExecute.Delete;

            var dia = new DialogueBox();

            dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), sell);
            dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel);
            dia.Timeout = new TimeSpan(0, 1, 0);
            dia.Embed   = new EmbedBuilder()
                          .WithAuthor(Context.User)
                          .WithColor(BasicUtil.RandomColor())
                          .WithDescription($"Sell **{waifu.Name}** for **{worth.ToString("n0")}** toasties?").Build();

            await DialogueReplyAsync(dia);

            return;
        }
Beispiel #3
0
        public async Task Divorce([Remainder] string str = "")
        {
            //common variables
            IUser        user = Context.User;
            EmbedBuilder eb   = new EmbedBuilder();

            Discord.Color userColour = ProfileDb.GetHex(out string colour, user.Id) ? (Discord.Color)UserUtil.HexToColor(colour) : BasicUtil.RandomColor();
            eb.WithColor(userColour);
            eb.WithAuthor(user);

            var marriages = MarriageDb.GetMarriages(user.Id, Context.Guild.Id);
            var marriage  = await UserUtil.SelectMarriage(marriages, this);

            if (marriage == null)
            {
                eb.WithDescription("~ You are not married ~");
                await Context.Channel.SendMessageAsync($"", false, eb.Build());

                return;
            }

            ulong wife = UserUtil.GetWifeId(marriage, user.Id);
            //
            //creating divorce action
            var divorce = new DialogueBoxOption {
                Action = async(IUserMessage message) => {
                    await MarriageDb.DeleteMarriageOrProposal(marriage);

                    await message.ModifyAsync((x) => x.Embed = eb.WithDescription($"You divorced **{ BasicUtil.IdToMention(wife) }**.\n*~ May you both find happiness elsewhere ~*").Build());

                    //execution condition
                }, After = OnExecute.RemoveReactions
            };

            //creating cancel
            var cancel = new DialogueBoxOption {
                After = OnExecute.Delete
            };

            //making dialog embed
            var dia = new DialogueBox();

            dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), divorce);
            dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel);
            dia.Timeout = new TimeSpan(0, 1, 0);
            dia.Embed   = new EmbedBuilderPrepared(user)
                          .WithColor(userColour)
                          .WithDescription($"Are you sure you wish to Divorce **{ BasicUtil.IdToMention(wife) }**?").Build();

            //
            await DialogueReplyAsync(dia);
        }