internal static TwitchChatEvent Parse(ITwitchFactory factory, string chatEventCommand)
        {
            string command;

            // TODO, support Mod events -- e.g. :jtv MODE #hardlysober +o arbedii

            if(chatEventCommand.StartsWith("PING")) {
                command = "PING";
            } else {
                command = chatEventCommand.GetBetween(" ", " ");
            }

            if(command.Equals("PRIVMSG")) {
                TwitchChannel channel = ParseChannel(factory, chatEventCommand);
                TwitchUser user = ParseUser(factory, chatEventCommand);
                string message = chatEventCommand.GetAfter("#" + channel.user.userName + " :");

                return new TwitchChatMessage(channel, user, message);
            } else if(command.Equals("WHISPER")) {
                TwitchUser user = ParseUser(factory, chatEventCommand);
                string message = chatEventCommand.GetAfter(" :");

                return new TwitchChatWhisper(user, message);
            } else if(command.Equals("PING")) {
                return new TwitchChatPing();
            } else {
                return new TwitchChatUnknownEvent(chatEventCommand);
            }
        }
        public TwitchIrcConnection(ITwitchFactory factory, TwitchBot bot, bool whisperServer)
        {
            this.factory       = factory;
            this.bot           = bot;
            this.whisperServer = whisperServer;

            Reconnect();
        }
        public TwitchIrcConnection(ITwitchFactory factory, TwitchBot bot, bool whisperServer)
        {
            this.factory = factory;
            this.bot = bot;
            this.whisperServer = whisperServer;

            Reconnect();
        }
        public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection,
			 TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection)
        {
            this.factory = factory;
            this.chatIrcConnection = chatConnection;
            this.whisperIrcConnection = whisperConnection;
            this.twitchConnection = twitchConnection;
            this.pointManager = new ChannelPointManager(factory, twitchConnection.channel);

            chatConnection.Join(this);

            TypeHelpers.InstantiateEachSubclass<IAutoJoinTwitchRooms, TwitchChatRoom>(this);
        }
Beispiel #5
0
        public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection,
                              TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection)
        {
            this.factory              = factory;
            this.chatIrcConnection    = chatConnection;
            this.whisperIrcConnection = whisperConnection;
            this.twitchConnection     = twitchConnection;
            this.pointManager         = new ChannelPointManager(factory, twitchConnection.channel);

            chatConnection.Join(this);

            TypeHelpers.InstantiateEachSubclass <IAutoJoinTwitchRooms, TwitchChatRoom>(this);
        }
Beispiel #6
0
        internal static TwitchChatEvent Parse(ITwitchFactory factory, string chatEventCommand)
        {
            string command;

            // TODO, support Mod events -- e.g. :jtv MODE #hardlysober +o arbedii

            if (chatEventCommand.StartsWith("PING"))
            {
                command = "PING";
            }
            else
            {
                command = chatEventCommand.GetBetween(" ", " ");
            }

            if (command.Equals("PRIVMSG"))
            {
                TwitchChannel channel = ParseChannel(factory, chatEventCommand);
                TwitchUser    user    = ParseUser(factory, chatEventCommand);
                string        message = chatEventCommand.GetAfter("#" + channel.user.userName + " :");

                return(new TwitchChatMessage(channel, user, message));
            }
            else if (command.Equals("WHISPER"))
            {
                TwitchUser user    = ParseUser(factory, chatEventCommand);
                string     message = chatEventCommand.GetAfter(" :");

                return(new TwitchChatWhisper(user, message));
            }
            else if (command.Equals("PING"))
            {
                return(new TwitchChatPing());
            }
            else
            {
                return(new TwitchChatUnknownEvent(chatEventCommand));
            }
        }
Beispiel #7
0
 public TwitchApi(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchJson = new TwitchJson(factory);
 }
Beispiel #8
0
 public TwitchApi(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchJson   = new TwitchJson(factory);
 }
 public ChannelPointManager(ITwitchFactory factory, TwitchChannel channel)
 {
     this.factory = factory;
     this.channel = channel;
     units        = LoadUnits(channel);
 }
Beispiel #10
0
 private static TwitchChannel ParseChannel(ITwitchFactory factory, string chatEventCommand)
 {
     return(factory.GetChannel(factory.GetUserFromName(chatEventCommand.GetBetween(" #", " "))));
 }
Beispiel #11
0
 private static TwitchUser ParseUser(ITwitchFactory factory, string chatEventCommand)
 {
     return(factory.GetUserFromName(chatEventCommand.GetBetween(":", "!")));
 }
Beispiel #12
0
 public TwitchUserPointManager(ITwitchFactory factory, TwitchChannel channel, TwitchUser user)
 {
     sqlPoints = factory.GetUserPoints(user, channel);
 }
 public ChannelPointManager(ITwitchFactory factory, TwitchChannel channel)
 {
     this.factory = factory;
     this.channel = channel;
     units = LoadUnits(channel);
 }
 public TwitchChatBot(ITwitchFactory factory)
 {
     this.factory = factory;
 }
Beispiel #15
0
 public TwitchJson(ITwitchFactory factory)
 {
     this.factory = factory;
 }
 private static TwitchChannel ParseChannel(ITwitchFactory factory, string chatEventCommand)
 {
     return factory.GetChannel(factory.GetUserFromName(chatEventCommand.GetBetween(" #", " ")));
 }
 private static TwitchUser ParseUser(ITwitchFactory factory, string chatEventCommand)
 {
     return factory.GetUserFromName(chatEventCommand.GetBetween(":", "!"));
 }
Beispiel #18
0
 public Twitch(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchApi    = new TwitchApi(factory);
 }
 public TwitchUserPointManager(ITwitchFactory factory, TwitchChannel channel, TwitchUser user)
 {
     sqlPoints = factory.GetUserPoints(user, channel);
 }
Beispiel #20
0
 public TwitchJson(ITwitchFactory factory)
 {
     this.factory = factory;
 }