Esempio n. 1
0
        public async Task Test()
        {
            using (NekoDbContext dbContext = new NekoDbContext())
            {
                var modLog = dbContext.ModerationLogs;

                foreach (var item in modLog)
                {
                    await ReplyAsync(String.Format("{0,5} {1,5} {2,5} {3,5}", item.Timestamp, item.Action, item.Reason, $"<@{item.TargetedUserId}>"));
                }
            }
        }
        private async Task AddModerationLog(ModerationLog.ModAction action, IGuildUser user, string reason)
        {
            using (NekoDbContext dbContext = new NekoDbContext())
            {
                ModerationLog newModerationLog = new ModerationLog
                {
                    ExecutingUserId   = context.User.Id,
                    ExecutingUsername = context.User.Username,
                    TargetedUserId    = user.Id,
                    TargetUsername    = user.Username,
                    Reason            = reason,
                    Timestamp         = DateTime.UtcNow
                };

                dbContext.ModerationLogs.Add(newModerationLog);
                await dbContext.SaveChangesAsync();
            }
        }
Esempio n. 3
0
        public static void LoadConfig()
        {
#if DEBUG
            BotToken      = "";
            CommandPrefix = '!';
            Debug         = true;
#elif RELEASE
            BotToken      = "";
            CommandPrefix = '&';
            Debug         = false;
#endif

            //TODO Load config file


            //TODO Check if DB file exist
            using (NekoDbContext dbContext = new NekoDbContext())
            {
                //TODO Load DB Config
            }
        }
 public BaseRepository(NekoDbContext context)
 {
     _dbContext = context;
 }
Esempio n. 5
0
 public MenuRepository(NekoDbContext context) : base(context)
 {
 }
 public QuestionRepository(NekoDbContext context) : base(context)
 {
 }
 public SolutionRepository(NekoDbContext context) : base(context)
 {
 }
Esempio n. 8
0
 public ExamPaperRepository(NekoDbContext context) : base(context)
 {
 }
 public ExamRecordQuestionRepository(NekoDbContext context) : base(context)
 {
 }
 public ExamRecordRepository(NekoDbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 11
0
 public UserRepository(NekoDbContext context) : base(context)
 {
 }
Esempio n. 12
0
 public RoleRepository(NekoDbContext context) : base(context)
 {
 }