Example #1
0
    private void Start()
    {
        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        ServicePointManager.ServerCertificateValidationCallback = CertificateValidationMonoFix;
        twitchInfo = new TwitchInfo();
        TwitchAPI twitchAPI = new TwitchAPI();

        twitchAPI.Settings.ClientId = twitchInfo.ClientID;
        ConnectionCredentials credentials = new ConnectionCredentials(twitchInfo.BotUsername, twitchInfo.BotToken);

        client = new TwitchClient(credentials, twitchInfo.ChannelName);
        EventHandlerSetup(client);
        client.Connect();
    }
Example #2
0
        static void Main(string[] args)
        {
            List <string> channels = new List <string>()
            {
                "ZeratoR",
                "TehBeardedGamer",
                "Tatshukoo",
                "mirymirv7",
                "FizZoR",
                "A5StarDiningExperience",
                "Areliann",
                "Aero514",
                "Seansstream",
                "LIZERDBITS",
                "Frogsama",
                "Stormless",
                "Telecast3r",
                "demonsgalore_",
                "StarfishprimeX0",
                "DreggmanWhite"
            };

            var twitchinfo         = new TwitchInfo("irc.twitch.tv", 6667);
            var bot                = new Bot(twitchinfo, "your_bot_login", "your_bot_oauth");
            var botModule          = new BotModule(bot);
            var consoleModule      = new OutputConsoleModule();
            var respectPremUsers   = new RespectPremiumUsersModule();
            var respectFriendUsers = new RespectFriendUsersModule();
            var parserModule       = new ParserModule();
            var hunterModule       = new HunterModule("OfficialParagonBot", "", consoleModule);

            var commandModule = new CommandModule(botModule, consoleModule, respectPremUsers, respectFriendUsers);
            var monitormodule = new MonitoringModule(botModule, commandModule, parserModule);

            consoleModule.HiglightMessage(ConsoleColor.Green, "!!!!!!!!!!Стартую наблюдение!!!!!!!!!!!!");
            //monitormodule.StartListenChannel("your_channel");
            monitormodule.StartListenChannels(channels, hunterModule);
        }
Example #3
0
        private int getViewrCount()
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.twitch.tv/kraken/streams/" + roomId);

            request.Method      = "GET";
            request.ContentType = "text/html;charset=UTF-8";
            request.UserAgent   = null;
            request.Headers.Add("Client-ID", "5kw217mse7lux1wklk19hf7qr0yn6e");

            HttpWebResponse response         = (HttpWebResponse)request.GetResponse();
            Stream          myResponseStream = response.GetResponseStream();
            StreamReader    myStreamReader   = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
            string          retString        = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();



            TwitchInfo info = JsonConvert.DeserializeObject <TwitchInfo>(retString.Trim());


            return(info.stream.viewers);
        }