Пример #1
0
        public static async Task <Tweet> Peek()
        {
            Tweet tweet = null;
            var   table = await AbbysqlClient.FetchSQL($"SELECT * FROM `twitter`.`archive` ");

            if (table.Count < 1)
            {
                throw new Exception("no tweets in list");
            }
            //Console.WriteLine($"You have {table.Count} items in the tweetarchive");
            AbbyRow row = table[r.Next(0, table.Count)];

            tweet = new Tweet()
            {
                id        = (int)row["Id"],
                url       = (row["ImgUrl"] is string i) ? i : "",
                sourceurl = (row["SrcUrl"] is string s) ? s : "",
                message   = (row["Description"] is string m) ? m : "",
                priority  = (sbyte)row["Priority"] == 1,
                GelId     = (row["GelId"] is int gild ? gild : 0),
                md5       = (row["md5"] is string smd5) ? smd5 : "",
                source    = "tweetarchive"
            };

            return(tweet);
        }
Пример #2
0
        public static async Task <(string favoritecharacter, bool isLewd, ulong marriedid)> GetUserData(ulong Id)
        {
            var table = await AbbysqlClient.FetchSQL($"SELECT `UserId` FROM `user`.`users` WHERE `UserId` = '{Id}';");

            if (table.Count < 1)
            {
                await AbbysqlClient.RunSQL($"INSERT INTO `user`.`users`(UserId, FavoriteCharacter) VALUES ('{Id}','Abigail_Williams*');");
            }

            table = await AbbysqlClient.FetchSQL($"SELECT `user`.`users`.* FROM `user`.`users` WHERE users.UserId = {Id};");

            AbbyRow row = table[0];

            (string favoritecharacter, bool isLewd, ulong marriedid)gol = ("Abigail_Williams*", true, 0);

            gol.favoritecharacter = (row["FavoriteCharacter"] is string s) ? s : "abigail_williams*";
            gol.isLewd            = row["IsLewd"] is ulong il && il == 1;
            gol.marriedid         = row["MarriedUserId"] is ulong mid ? mid : 0;

            return(gol);
        }