Example #1
0
        public Bot()
        {
            BotName = "tmpName";
            ViewerRepository load = AssistantDb.Instance.Viewers;

            _viewersController = new ViewersController();

            try
            {
                ConnectionCredentials credentials;
                if (ConfigSet.Config.BotConfig.IsDualMode)
                {
                    BotName     = ConfigSet.Config.BotConfig.BotName;
                    credentials = new ConnectionCredentials(BotName, ConfigSet.Config.Auth.BotAuth.Tokens.AccessToken);
                    BotName     = "";
                }
                else
                {
                    credentials = new ConnectionCredentials(BotName, ConfigSet.Config.Auth.StreamerAuth.Tokens.AccessToken);
                    BotName     = "@" + ConfigSet.Config.BotConfig.BotName + " -> ";
                }
                Client = new TwitchClient();
                Client.Initialize(credentials, ConfigSet.Config.BotConfig.StreamName);
                Client.OnConnected       += Client_OnConnected;
                Client.OnConnectionError += Client_OnConnectedError;
                Client.OnDisconnected    += Client_onDisconnected;

                Client.OnUserJoined    += OnUserJoined;
                Client.OnUserLeft      += OnUserLeft;
                Client.OnNewSubscriber += OnNewSubscriber;

                Client.OnJoinedChannel   += OnJoinedChannel;
                Client.OnMessageReceived += OnMessageReceived;
                Client.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Bot constructor ex : incorrect bot name");
            }
        }
Example #2
0
 public ViewerApiController(ViewerRepository repository)
 {
     this.repository = repository;
     this.OnCreated();
 }
Example #3
0
 public ViewerService()
 {
     viewerRepository = new ViewerRepository();
 }