Beispiel #1
0
        public async Task AddAllDrip(CommandContext ctx)
        {
            using (DripContext drip = new DripContext())
            {
                try
                {
                    var lines = File.ReadAllLines(@"Textfiles\DripCharacters.json");

                    foreach (var line in lines)
                    {
                        var myTitle    = line.Substring(0, line.IndexOf("-="));
                        var myImageUrl = line.Substring(line.IndexOf("-=") + 2);
                        drip.Drip.Add(new Drip
                        {
                            Title    = myTitle,
                            ImageURL = myImageUrl
                        });
                    }
                    await drip.SaveChangesAsync();

                    await ctx.Channel.SendMessageAsync("complete");
                }
                catch (Exception e)
                {
                    await ctx.Channel.SendMessageAsync(e.ToString());
                }
            }
        }
Beispiel #2
0
        public async Task AddDrip(CommandContext ctx, string imgURL, [RemainingText] string name)
        {
            var interactivity = ctx.Client.GetInteractivity();

            using (SqliteContext lite = new SqliteContext())
            {
                var dripEmbed = new DiscordEmbedBuilder
                {
                    Title       = ":fire:" + name + " DRIP :fire:",
                    Description = $"Are you sure this what you want? (You cannot remove it once you confirm)",
                    ImageUrl    = imgURL,
                    Color       = DiscordColor.Black
                };

                await ctx.Channel.SendMessageAsync(embed : dripEmbed);

                await ctx.Channel.SendMessageAsync($"**{ctx.Member.DisplayName}**, respond with \"y\" to confirm.");

                var confirmation = await interactivity.WaitForMessageAsync(x => x.Channel == ctx.Channel &&
                                                                           x.Author.Id == ctx.Member.Id);

                if (confirmation.Result.Content.ToString() != "y")
                {
                    await ctx.Channel.SendMessageAsync("`request cancelled.`");

                    return;
                }

                using (DripContext drip = new DripContext())
                {
                    var  list    = drip.Drip.ToListAsync().Result;
                    Drip newDrip = new Drip
                    {
                        Title    = name,
                        ImageURL = imgURL,
                    };
                    foreach (var item in list)
                    {
                        if (item.Title == name)
                        {
                            await ctx.Channel.SendMessageAsync("Drip Already Exists.");

                            return;
                        }
                    }

                    await ctx.Channel.SendMessageAsync("`success!`");

                    drip.Drip.Add(newDrip);
                    await drip.SaveChangesAsync();
                }
            }
        }
Beispiel #3
0
        public async Task MigrateDrip(CommandContext ctx)
        {
            Console.WriteLine("*** migrating... ***");

            await using DripContext lite = new DripContext();

            if (lite.Database.GetPendingMigrationsAsync().Result.Any())
            {
                await lite.Database.MigrateAsync();
            }

            await ctx.Channel.SendMessageAsync($"Sqlite Migration complete");
        }
Beispiel #4
0
        public async Task DripRemove(CommandContext ctx, [RemainingText] string name)
        {
            using (DripContext drip = new DripContext())
            {
                var interactivity = ctx.Client.GetInteractivity();

                var selectedDrip = drip.Drip.FirstOrDefault(x => x.Title == name);

                if (selectedDrip == default)
                {
                    await ctx.Channel.SendMessageAsync("drip not found.");

                    return;
                }

                var dripEmbed = new DiscordEmbedBuilder
                {
                    Title       = ":fire:" + selectedDrip.Title + " DRIP :fire:",
                    Description = $"Are you sure you want to delete this one?",
                    ImageUrl    = selectedDrip.ImageURL,
                    Color       = DiscordColor.Black
                };

                await ctx.Channel.SendMessageAsync(embed : dripEmbed);

                await ctx.Channel.SendMessageAsync($"**{ctx.Member.DisplayName}**, respond with \"y\" to confirm.");

                var confirmation = await interactivity.WaitForMessageAsync(x => x.Channel == ctx.Channel &&
                                                                           x.Author.Id == ctx.Member.Id);

                if (confirmation.Result.Content.ToString() == "y")
                {
                    await ctx.Channel.SendMessageAsync("`success!`");
                }
                else
                {
                    await ctx.Channel.SendMessageAsync("`request cancelled.`");

                    return;
                }

                drip.Remove(selectedDrip);
                await drip.SaveChangesAsync();
            }
        }
Beispiel #5
0
        public async Task DripList(CommandContext ctx)
        {
            using (DripContext drip = new DripContext())
            {
                var list = await drip.Drip.ToListAsync();

                var listEmbed = new DiscordEmbedBuilder
                {
                    Title       = "Drip List",
                    Description = $"{list.Count()} total items."
                };
                foreach (var item in drip.Drip)
                {
                    listEmbed.Description += $"\n{item.Title}";
                }
                await ctx.Channel.SendMessageAsync(embed : listEmbed);
            }
        }
Beispiel #6
0
        public async Task DisplayProfile(CommandContext ctx, DiscordMember member = null)
        {
            if (member == null)
            {
                member = ctx.Member;
            }

            using (SqliteContext lite = new SqliteContext())
            {
                var userProfile = await GetOrCreateProfileAsync(lite, member, ctx.Guild.Id);

                string tier         = GetTier(userProfile.Tier);
                var    profileEmbed = new DiscordEmbedBuilder
                {
                    Title       = $"{member.Username}'s Profile",
                    Color       = DiscordColor.SapGreen,
                    Description = $"Current Tier: **{tier}**"
                };
                profileEmbed.WithThumbnail(member.AvatarUrl);

                var dripScore = userProfile.DripScore;
                profileEmbed.AddField("Drip Score:", $"**{dripScore}** :fire:");
                var collectedDrip = userProfile.DripInventory.Split("\n").Length;

                using (DripContext drip = new DripContext())
                {
                    profileEmbed.AddField("Discovered:", $"**{collectedDrip - 1}**/{drip.Drip.Count()} :scroll:");
                }
                profileEmbed.AddField("Casino Tickets", $"**{userProfile.GambleTickets}** :tickets:");
                if (userProfile.GambleCount >= maxGambleCount)
                {
                    profileEmbed.AddField
                        ("Tickets used:", $"You have reached your quota for spending tickets today, use **\"m!rq\"** to refresh once a daily to refresh yur quota.");
                }
                profileEmbed.AddField("Tickets used:", $"**{userProfile.GambleCount}**/{maxGambleCount}");

                await ctx.Channel.SendMessageAsync(embed : profileEmbed);
            }
        }
Beispiel #7
0
        public async Task DoDrip(CommandContext ctx)
        {
            var currentDate = DateTime.Now;

            using (SqliteContext lite = new SqliteContext())
            {
                var recordedUser = GetOrCreateProfileAsync(lite, ctx.Member, ctx.Guild.Id).Result;

                //Checks if cooldown is over for the user or user is not recorded
                if (recordedUser.DripCooldown < currentDate)
                {
                    //records user and their values
                    int userDripScoreAdd = new Random().Next(4, 10);
                    int tryUltraDrip     = new Random().Next(0, 200);
                    if (tryUltraDrip == 50)
                    {
                        userDripScoreAdd = 50;
                    }

                    recordedUser.DripScore   += userDripScoreAdd;
                    recordedUser.DripCooldown = DateTime.Now.AddHours(4);
                    await lite.SaveChangesAsync();

                    string myTitle;
                    string myImageUrl;
                    Drip   myResult;
                    using (DripContext drip = new DripContext())
                    {
                        var lineRandom = new Random().Next(0, drip.Drip.Count() + 1);
                        var myList     = drip.Drip.ToListAsync();
                        myResult = myList.Result.ElementAt(lineRandom);

                        myImageUrl = myResult.ImageURL;
                        myTitle    = $":fire: {myResult.Title} DRIP :fire:";
                    }

                    //Seperate string elements
                    if (tryUltraDrip == 50)
                    {
                        myTitle    = $":fire::fire::fire:「GOD DRIP」 :fire: :fire: :fire: ";
                        myImageUrl = "https://cdn.discordapp.com/attachments/799182994992267284/799510817405927444/ElNHS9bXIAEi5gB.png";
                    }

                    var dripEmbed = new DiscordEmbedBuilder
                    {
                        Title       = myTitle,
                        Description = $"**{ctx.Member.DisplayName}**, Drip",
                        ImageUrl    = myImageUrl,
                        Color       = DiscordColor.Rose
                    };
                    if (userDripScoreAdd == 50)
                    {
                        dripEmbed.AddField("** **", $"**+{userDripScoreAdd}** Drip, **Wow!**");
                    }
                    else
                    {
                        dripEmbed.AddField("** **", $"**+{userDripScoreAdd}** Drip");
                    }

                    if (!recordedUser.DripInventory.Contains(myTitle))
                    {
                        recordedUser.DripInventory += $"\n{myTitle}";
                        dripEmbed.AddField("**NEW DRIP DISCOVERED**", $"**{myResult.Title}** has been added to your collection.");
                        await lite.SaveChangesAsync();
                    }

                    await ctx.Channel.SendMessageAsync(embed : dripEmbed);
                }
                else
                {
                    var coolDownTimespan = recordedUser.DripCooldown - currentDate;
                    await ctx.Channel.SendMessageAsync($"**{ctx.Member.DisplayName}**, you can do this command again in " +
                                                       $"**{coolDownTimespan.Hours}h {coolDownTimespan.Minutes} mins**");
                }
            }
        }