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); }
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); }
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); }
public Player(BotUser user) { Id = user.Telegramid; User = user; }