Exemple #1
0
        public SchedulingService(PmConfig config, PmDiscordClient client, LoggingService log, GameService games)
        {
            this.client = client;
            this.log    = log;
            this.games  = games;

            scheduledRestart = config.scheduledRestart;
        }
        public PmCommandService(IServiceProvider services, PmConfig config,
                                PmDiscordClient client, LoggingService log, StorageService storage)
            : base(CommandConfig)
        {
            this.services = services;
            this.client   = client;
            this.log      = log;
            this.storage  = storage;

            CommandExecuted += OnCommandExecuted;
        }
        public InputService(PmConfig config, PmDiscordClient client, LoggingService log,
                            StorageService storage, PmCommandService commands, GameService games)
        {
            this.client   = client;
            this.commands = commands;
            this.storage  = storage;
            this.log      = log;
            this.games    = games;

            bannedChannels = config.bannedChannels;

            pendingResponses = new ConcurrentDictionary <PendingResponse, byte>();
        }
        public LoggingService(PmConfig config)
        {
            logLevel       = config.logLevel;
            hardExclusions = config.logExclude;

            const string template = "{Timestamp:HH:mm:ss}|{Level:u3}|{Message}{NewLine}";

            logger = new LoggerConfiguration()
                     .MinimumLevel.Verbose()
                     .WriteTo.Console(outputTemplate: template)
                     .WriteTo.RollingFile("logs/{Date}.txt", outputTemplate: template)
                     .CreateLogger();
        }
        public StorageService(PmConfig config, PmDiscordClient client, LoggingService log)
        {
            this.client = client;
            this.log    = log;

            DefaultPrefix = config.defaultPrefix;
            dbConnection  = config.dbConnectionString;

            cachedPrefixes           = new ConcurrentDictionary <ulong, string>();
            cachedAllowsAutoresponse = new ConcurrentDictionary <ulong, bool>();
            cachedNeedsPrefix        = new ConcurrentDictionary <ulong, bool>();

            using (var db = MakeDbContext())
            {
                db.Database.EnsureCreated();
                log.Info("Database ready", LogSource.Storage);
            }
        }
Exemple #6
0
 public PmDiscordClient(PmConfig config)
     : base(config.ClientConfig)
 {
     ShardReady += OnShardReady;
 }