Пример #1
0
        public IActionResult VisitorTracker(VisitorTracker visitor)
        {
            dbContext.VisitorTrackers.Add(visitor);
            dbContext.SaveChanges();

            return(new EmptyResult());
        }
Пример #2
0
        public static void InitializeBot(Secrets secrets)
        {
            Secrets = secrets;

            HostChannelName = secrets.HostChannelName;
            TMICredentials  = new ConnectionCredentials(secrets.HostChannelName, secrets.BotTMIOAuthKey);


            TwitchClient = new TwitchClient();

            TwitchClient.Initialize(TMICredentials, secrets.HostChannelName);
            if (!TwitchClient.IsInitialized)
            {
                Console.WriteLine("Twitch Client did not initialize.");
                return;
            }

            TwitchClient.Connect();
            if (!TwitchClient.IsConnected)
            {
                Console.WriteLine("Twitch Client was not able to connect.");
                return;
            }

            TwitchClient.JoinChannel(secrets.HostChannelName);

            BotAPI = new TwitchAPI();
            BotAPI.Settings.ClientId = Secrets.BotClientID;
            BotAPI.Settings.Secret   = secrets.BotClientSecret;

            HostAPI = new TwitchAPI();
            HostAPI.Settings.ClientId = Secrets.HostClientID;
            HostAPI.Settings.Secret   = secrets.HostClientSecret;


            CommandsHandler = new CommandsHandler();
            VisitorTracker  = new VisitorTracker();
            CurrencyHandler = new CurrencyHandler();


            TwitchClient.OnLog += OnLog;
        }