private Task AddUserToDb(SocketMessage arg) { using (var dctx = new CwsContext()) { User DbUser = dctx.Users.SingleOrDefault(x => x.UserId == arg.Author.Id); if (DbUser is null) { User NewDbUser = new User { UserId = arg.Author.Id, Karma = 0, WarningCount = 0, MessageCount = 1, Tokens = 0, KarmaTime = DateTimeOffset.Now.AddDays(-1), Username = arg.Author.Username }; dctx.Add(NewDbUser); dctx.SaveChanges(); return(Task.CompletedTask); } DbUser.MessageCount++; dctx.SaveChanges(); return(Task.CompletedTask); } }
public TagsModule(CwsContext dbContext) { _dbContext = dbContext; }
public ModTagModule(CwsContext dbContext) => this._dbContext = dbContext;
public CasinoModule(CwsContext dctx) { _dctx = dctx; }
public PublicModule(CommandService service, CwsContext dctx, IConfiguration config) { _service = service; _dctx = dctx; _config = config; }
public KarmaModule(CwsContext dbContext) { this._dbContext = dbContext; }