Exemplo n.º 1
0
        public static ulong GetKinkFromMenu(KinkGroupMenu menu, IEmote myEmote)
        {
            using (var DbContext = new SqliteDbContext())
            {
                Console.WriteLine("emote name - " + myEmote.Name);
                Console.WriteLine("tostring - " + myEmote.ToString());

                var aKinkEmoji = DbContext.KinkEmojis.Where(x => x.ServerID == menu.ServerID && x.KinkGroupID == menu.KinkGroupID && x.EmojiName.Remove(x.EmojiName.IndexOf("<a") > -1 ? 1 : 0, x.EmojiName.IndexOf("<a") > -1 ? 1 : 0) == myEmote.ToString()).FirstOrDefault();

                if (aKinkEmoji == null)
                {
                    return(0);
                }

                return(aKinkEmoji.KinkID);
            }
        }
Exemplo n.º 2
0
        public static async Task AddKinkMenu()
        {
            using (var DbContext = new SqliteDbContext())
            {
                //need to update the following:
                //group records - write kink or limit server/channel

                KinkGroupMenu groupMenu = DbContext.KinkGroupMenus.Where(x => x.KinkGroupID == Vars.menuBuilder.KinkGroupID && x.ServerID == Vars.menuBuilder.ServerID).FirstOrDefault();

                if (groupMenu == null && !Vars.menuBuilder.IsLimitMenu)
                {
                    //groupMenu = new

                    DbContext.KinkGroupMenus.Add(new KinkGroupMenu
                    {
                        KinkGroupID   = Vars.menuBuilder.KinkGroupID,
                        ServerID      = Vars.menuBuilder.ServerID,
                        KinkMsgID     = Vars.menuBuilder.EmojiMenuID,
                        KinkChannelID = Vars.menuBuilder.ChannelID
                    });;
                }
                else if (groupMenu == null && Vars.menuBuilder.IsLimitMenu)
                {
                    DbContext.KinkGroupMenus.Add(new KinkGroupMenu
                    {
                        KinkGroupID    = Vars.menuBuilder.KinkGroupID,
                        ServerID       = Vars.menuBuilder.ServerID,
                        LimitMsgID     = Vars.menuBuilder.EmojiMenuID,
                        LimitChannelID = Vars.menuBuilder.ChannelID
                    });
                }
                else if (!Vars.menuBuilder.IsLimitMenu)
                {
                    groupMenu.KinkGroupID   = Vars.menuBuilder.KinkGroupID;
                    groupMenu.ServerID      = Vars.menuBuilder.ServerID;
                    groupMenu.KinkChannelID = Vars.menuBuilder.ChannelID;
                    groupMenu.KinkMsgID     = Vars.menuBuilder.EmojiMenuID;
                }
                else if (Vars.menuBuilder.IsLimitMenu)
                {
                    groupMenu.KinkGroupID    = Vars.menuBuilder.KinkGroupID;
                    groupMenu.ServerID       = Vars.menuBuilder.ServerID;
                    groupMenu.LimitChannelID = Vars.menuBuilder.ChannelID;
                    groupMenu.LimitMsgID     = Vars.menuBuilder.EmojiMenuID;
                }

                DbContext.KinkEmojis.RemoveRange(DbContext.KinkEmojis.Where(x => x.ServerID == Vars.menuBuilder.ServerID && Vars.menuBuilder.KinksToUpdate.Any(y => y.KinkID == x.KinkID)));

                foreach (var kinkEmoji in Vars.menuBuilder.KinksToUpdate)
                {
                    DbContext.KinkEmojis.Add(new KinkEmoji
                    {
                        ServerID    = Vars.menuBuilder.ServerID,
                        KinkID      = kinkEmoji.KinkID,
                        EmojiName   = kinkEmoji.EmojiName,
                        KinkGroupID = Vars.menuBuilder.KinkGroupID,
                    });
                }

                await DbContext.SaveChangesAsync();

                ReloadMenus();
            }
        }