Пример #1
0
        public static BotUser CreateBotUser(this User u)
        {
            string name = string.IsNullOrEmpty(u.LastName) ? u.FirstName : $"{u.FirstName} {u.LastName}";
            var    bu   = new BotUser(u.Id, name, u.Username, 0, "", Language.English);

            SQL.CreateBotUser(bu);
            Users.Add(bu);
            return(bu);
        }
Пример #2
0
        public static void CreateBotUser(BotUser bu)
        {
            string query;

            if (string.IsNullOrEmpty(bu.Username))
            {
                query = $"insert into users (telegramid, name) values ({bu.Telegramid}, '{bu.Name.Replace("'", "''")}')";
            }
            else
            {
                query = $"insert into users (telegramid, name, username) values ({bu.Telegramid}, '{bu.Name.Replace("'", "''")}', '{bu.Username}')";
            }
            RunNoQuery(query);
        }
Пример #3
0
        public static void ChangeBotUser(BotUser bu)
        {
            string query = $"update users set name = '{bu.Name.Replace("'", "''")}', username = '******', language = '{bu.Language.Name}', subscribing = '{bu.Subscriptions}' where telegramid = {bu.Telegramid}";

            RunNoQuery(query);
        }
Пример #4
0
 public Player(BotUser user)
 {
     Id   = user.Telegramid;
     User = user;
 }