Esempio n. 1
0
        public Session(Settings settings)
        {
            _settings = settings;

            Console.WriteLine("Setting up endpoint urls...");
            ApiEndpoint.ServerStatsUrl = _settings.ServerEndpointStats;

            Console.WriteLine("Setting up translation...");
            _translate = new Translate(_log, settings.AzureToken, settings.TranslateTo);

            Console.WriteLine("Setting up github webhook...");
            GithubWebhookDelivery callback = GithubDelivery;

            _wcfServer = new WCFServer(callback);
            _wcfServer.Start();

            Console.WriteLine("Getting stats history...");
            if (File.Exists(Const.SERVICE_HOOKAPP_HISTORY))
            {
                _serviceHookappStats = JsonConvert.DeserializeObject <List <ServerStats> >(File.ReadAllText(Const.SERVICE_HOOKAPP_HISTORY));
            }
            else
            {
                _serviceHookappStats = new List <ServerStats>();
            }

            Console.WriteLine("Setting up github access...");
            var credentials = new InMemoryCredentialStore(new Credentials(_settings.GithubToken));

            _githubClient             = new GitHubClient(new ProductHeaderValue("HookApp"));
            _githubClient.Credentials = new Credentials(_settings.GithubToken);

            Console.WriteLine("Setting up cleverbot...");
            _cleverbot = new CleverbotSession(_settings.CleverbotToken);

            Console.WriteLine("Setting up discord...");
            _client                  = new DiscordSocketClient();
            _client.Log             += _client_Log;
            _client.Ready           += _client_Ready;
            _client.MessageReceived += _client_MessageReceived;
            InstallDiscordCommands();
        }
Esempio n. 2
0
 public WCFServer(GithubWebhookDelivery delivery)
 {
     DeliveryCallback = delivery;
 }